summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/glob.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-03-09 21:51:00 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-03-09 21:51:00 +0000
commitb1aae492d01d8124298d25eeac96e18dc9c09119 (patch)
tree51e3a45d589ab63fd81723a70ed60d94f6925b9e /winsup/cygwin/glob.c
parentf882fd15b0e665bd9da3c8edb7cddcb22b1085af (diff)
downloadcygnal-b1aae492d01d8124298d25eeac96e18dc9c09119.tar.gz
cygnal-b1aae492d01d8124298d25eeac96e18dc9c09119.tar.bz2
cygnal-b1aae492d01d8124298d25eeac96e18dc9c09119.zip
Switch to 32/64 datatypes:
* Makefile.in (OBSOLETE_FUNCTIONS): Add open acl aclcheck aclfrommode aclfrompbits aclfromtext aclsort acltomode acltopbits acltotext chown facl fchown fgetpos fopen freopen fseeko fsetpos fstat ftello ftruncate getegid geteuid getgid getgrent getgrgid getgrnam getgroups getpwuid getpwuid_r getuid initgroups lchown lseek lstat mknod mmap seekdir setegid seteuid setgid setgroups setregid setreuid setuid stat telldir truncate. (NEW_FUNCTIONS): Add _open64 acl32 aclcheck32 aclfrommode32 aclfrompbits32 aclfromtext32 aclsort32 acltomode32 acltopbits32 acltotext32 chown32 facl32 fchown32 fgetpos64 fopen64 freopen64 fseeko64 fsetpos64 fstat64 ftello64 ftruncate64 getegid32 geteuid32 getgid32 getgrent32 getgrgid32 getgrnam32 getgroups32 getpwuid32 getpwuid_r32 getuid32 initgroups32 lchown32 lseek64 lstat64 mknod32 mmap64 seekdir64 setegid32 seteuid32 setgid32 setgroups32 setregid32 setreuid32 setuid32 stat64 telldir64 truncate64 to substitute the above. * cygserver_shm.h (class client_request_shm): Change uid_t and gid_t members to __uid32_t and __gid32_t. * cygwin.din: Add symbols acl32 aclcheck32 aclfrommode32 aclfrompbits32 aclfromtext32 aclsort32 acltomode32 acltopbits32 acltotext32 facl32 fgetpos64 fopen64 freopen64 fseeko64 fsetpos64 _fstat64 ftello64 _lseek64 mknod32 _open64. * glob.c: Include perprocess.h. (globtilde): Call getpwuid32 and getuid32 instead of getpwuid and getuid. (g_lstat): Check for applications API version to call the appropriate typed gl_lstat function. (g_stat): Ditto for gl_stat. * shm.cc (client_request_shm::client_request_shm): Call geteuid32 and getegid32 instead of geteuid and getegid throughout. * syscalls.cc (_open64): New alias for open. (_lseek64): New alias for lseek64. (_fstat64): New alias for fseek64. (mknod32): New function. (mknod): Calls mknod32 now. * winsup.h: Make function declarations for getuid32, geteuid32, and getpwuid32 accessible for plain C sources. Add declarations for getegid32 and getpwnam. * include/cygwin/version.h: Bum API minor number to 78. * include/sys/cygwin.h: Guard C++ specific members of struct per_process against inclusion in plain C sources. * include/sys/mman.h (mman): Add guard to avoid type clash when compiling Cygwin.
Diffstat (limited to 'winsup/cygwin/glob.c')
-rw-r--r--winsup/cygwin/glob.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/winsup/cygwin/glob.c b/winsup/cygwin/glob.c
index 32e4e60d6..47f8ee120 100644
--- a/winsup/cygwin/glob.c
+++ b/winsup/cygwin/glob.c
@@ -80,6 +80,8 @@
#include <unistd.h>
#include <windows.h>
+#include "perprocess.h"
+
#ifdef __weak_alias
#ifdef __LIBC12_SOURCE__
__weak_alias(glob,_glob);
@@ -386,7 +388,7 @@ globtilde(pattern, patbuf, pglob)
* first and then trying the password file
*/
if ((h = getenv("HOME")) == NULL) {
- if ((pwd = getpwuid(getuid())) == NULL)
+ if ((pwd = getpwuid32(getuid32())) == NULL)
return pattern;
else
h = pwd->pw_dir;
@@ -831,16 +833,6 @@ g_lstat(fn, sb, pglob)
struct STAT *sb;
glob_t *pglob;
{
- /* FIXME: This only works as long as the application uses the old
- struct stat with 32 bit off_t types!!!
-
- As soon as we switch over to 64 bit, we have to decide by
- the applications API minor version number, whether to use
- a pointer to a __stat64 or a _stat32 struct to the
- pglob->gl_lstat function. */
-#ifdef __CYGWIN_USE_BIG_TYPES__
-#error FIXME check apps API minor and use correct struct stat
-#endif
char buf[MAXPATHLEN];
g_Ctoc(fn, buf);
@@ -848,7 +840,9 @@ g_lstat(fn, sb, pglob)
struct __stat32 lsb;
int ret;
- if (!(ret = (*pglob->gl_lstat)(buf, &lsb)))
+ if (user_data->api_major > 0 || user_data->api_minor > 77)
+ ret = (*pglob->gl_lstat)(buf, &sb);
+ else if (!(ret = (*pglob->gl_lstat)(buf, &lsb)))
stat32_to_STAT (&lsb, sb);
return ret;
}
@@ -865,16 +859,6 @@ g_stat(fn, sb, pglob)
struct STAT *sb;
glob_t *pglob;
{
- /* FIXME: This only works as long as the application uses the old
- struct stat with 32 bit off_t types!!!
-
- As soon as we switch over to 64 bit, we have to decide by
- the applications API minor version number, whether to use
- a pointer to a __stat64 or a _stat32 struct to the
- pglob->gl_stat function. */
-#ifdef __CYGWIN_USE_BIG_TYPES__
-#error FIXME check apps API minor and use correct struct stat
-#endif
char buf[MAXPATHLEN];
g_Ctoc(fn, buf);
@@ -882,6 +866,8 @@ g_stat(fn, sb, pglob)
struct __stat32 lsb;
int ret;
+ if (user_data->api_major > 0 || user_data->api_minor > 77)
+ ret = (*pglob->gl_stat)(buf, &sb);
if (!(ret = (*pglob->gl_stat)(buf, &lsb)))
stat32_to_STAT (&lsb, sb);
return ret;