diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2005-02-24 15:17:51 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2005-02-24 15:17:51 +0000 |
commit | d9f1193ad69f78474293454347f6f42f1e186cf0 (patch) | |
tree | 8a5beb87b31afe97340bdbbbbabc049a7ea4293f | |
parent | 2b0160ca894fc19ab4c4c1d40a86af490acfeb44 (diff) |
INTEGRATION: CWS nativefixer4 (1.4.18); FILE MERGED
2005/02/17 09:54:23 obr 1.4.18.1: changing owner/group for download files
-rw-r--r-- | setup_native/scripts/source/getuid.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/setup_native/scripts/source/getuid.c b/setup_native/scripts/source/getuid.c index 15906c83b..5437afd75 100644 --- a/setup_native/scripts/source/getuid.c +++ b/setup_native/scripts/source/getuid.c @@ -7,6 +7,8 @@ extern "C" { #endif +#ifdef SOLARIS + int chown (const char *path, uid_t owner, gid_t group) {return 0;} int lchown (const char *path, uid_t owner, gid_t group) {return 0;} int fchown (int fildes, uid_t owner, gid_t group) {return 0;} @@ -21,6 +23,7 @@ gid_t getegid (void) {return 0;} int setuid (uid_t p) {return 0;} int setgid (gid_t p) {return 0;} +/* This is to fool cpio and pkgmk */ int fstat(int fildes, struct stat *buf) { int ret = 0; @@ -38,6 +41,46 @@ int fstat(int fildes, struct stat *buf) return ret; } +/* This is to fool tar */ +int fstatat64(int fildes, const char *path, struct stat64 *buf, int flag) +{ + int ret = 0; + static int (*p_fstatat) (int fildes, const char *path, struct stat64 *buf, int flag) = NULL; + if (p_fstatat == NULL) + p_fstatat = (int (*)(int fildes, const char *path, struct stat64 *buf, int flag)) + dlsym (RTLD_NEXT, "fstatat64"); + ret = (*p_fstatat)(fildes, path, buf, flag); + if (buf != NULL) + { + buf->st_uid = 0; /* root */ + buf->st_gid = 2; /* bin */ + } + + return ret; +} + +#elif defined LINUX + +/* This is to fool tar */ +int __lxstat64(int n, const char *path, struct stat64 *buf) +{ + int ret = 0; + static int (*p_lstat) (int n, const char *path, struct stat64 *buf) = NULL; + if (p_lstat == NULL) + p_lstat = (int (*)(int n, const char *path, struct stat64 *buf)) + dlsym (RTLD_NEXT, "__lxstat64"); + ret = (*p_lstat)(n, path, buf); + if (buf != NULL) + { + buf->st_uid = 0; /* root */ + buf->st_gid = 0; /* root */ + } + + return ret; +} + +#endif + #ifdef _cplusplus } #endif |