diff options
author | Christopher Faylor <me@cgf.cx> | 2003-05-29 07:50:15 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-05-29 07:50:15 +0400 |
commit | b666c2eb34f4f75e14229740f5f2de2d6d6c674f (patch) | |
tree | 633e4165f5b51fde3e73349f1670d8fa35095975 | |
parent | 72c1470d67d975abc6be3aa114c7932f63b413fa (diff) |
* mkvers.sh: Avoid "-dontuse" tags.
* path.cc (path_conv::check): Set exec state based on known situations.
* path.cc (mount_item::fnmunge): New function.
(mount_item::build_win32): New function.
(mount_info::conv_to_win32_path): Use build_win32 to build windows path.
* path.h (mount_item::fnmunge): Declare new function.
(mount_item::build_win32): Ditto.
* sys/mount.h (MOUNT_ENC): Define.
-rw-r--r-- | winsup/cygwin/ChangeLog | 14 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/mount.h | 3 | ||||
-rwxr-xr-x | winsup/cygwin/mkvers.sh | 2 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 88 | ||||
-rw-r--r-- | winsup/cygwin/shared_info.h | 2 |
5 files changed, 74 insertions, 35 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3fb244cd8..978b09c61 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,17 @@ +2003-05-28 Christopher Faylor <cgf@redhat.com> + + * mkvers.sh: Avoid "-dontuse" tags. + + * path.cc (path_conv::check): Set exec state based on known situations. + + * path.cc (mount_item::fnmunge): New function. + (mount_item::build_win32): New function. + (mount_info::conv_to_win32_path): Use build_win32 to build windows + path. + * path.h (mount_item::fnmunge): Declare new function. + (mount_item::build_win32): Ditto. + * sys/mount.h (MOUNT_ENC): Define. + 2003-05-28 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::dup): If running impersonated, diff --git a/winsup/cygwin/include/sys/mount.h b/winsup/cygwin/include/sys/mount.h index 57413740f..5915ddcae 100644 --- a/winsup/cygwin/include/sys/mount.h +++ b/winsup/cygwin/include/sys/mount.h @@ -28,7 +28,8 @@ enum not yet implemented */ MOUNT_NOTEXEC = 0x100, /* don't check files for executable magic */ MOUNT_DEVFS = 0x200, /* /device "filesystem" */ - MOUNT_PROC = 0x400 /* /proc "filesystem" */ + MOUNT_PROC = 0x400, /* /proc "filesystem" */ + MOUNT_ENC = 0x800 /* encode special characters */ }; int mount (const char *, const char *, unsigned __flags); diff --git a/winsup/cygwin/mkvers.sh b/winsup/cygwin/mkvers.sh index d14deb166..85d016b92 100755 --- a/winsup/cygwin/mkvers.sh +++ b/winsup/cygwin/mkvers.sh @@ -84,7 +84,7 @@ fn=`basename $incfile` # if it exists, will contain the name of the sticky tag associated with # the current build. Save that for output later. # -cvs_tag="`sed 's%^.\(.*\)%\1%' $dir/CVS/Tag 2>/dev/null`" +cvs_tag="`sed -e '/dontuse/d' -e 's%^.\(.*\)%\1%' $dir/CVS/Tag 2>/dev/null`" wv_cvs_tag="$cvs_tag" [ -n "$cvs_tag" ] && cvs_tag=" CVS tag"' diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index d381c4c61..d3d560fc1 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -793,7 +793,17 @@ out: if (!allow_smbntsec && fs.is_remote_drive) set_has_acls (false); else - set_has_acls (fs.flags & FS_PERSISTENT_ACLS); + { + set_has_acls (fs.flags & FS_PERSISTENT_ACLS); + if (exec_state () != dont_know_if_executable) + /* ok */; + else if (isdir ()) + set_exec (1); + else if (issymlink () || issocket () + || allow_ntsec && wincap.has_security ()) + set_exec (0); + + } /* Known file systems with buggy open calls. Further explanation in fhandler.cc (fhandler_disk_file::open). */ set_has_buggy_open (strcmp (fs.name, "SUNWNFS") == 0); @@ -1379,6 +1389,41 @@ set_flags (unsigned *flags, unsigned val) } } +void +mount_item::fnmunge (char *dst, const char *src) +{ + strcpy (dst, src); + backslashify (dst, dst, 0); +} + +void +mount_item::build_win32 (char *dst, const char *src, unsigned *outflags, unsigned chroot_pathlen) +{ + int n; + const char *real_native_path; + int real_posix_pathlen; + set_flags (outflags, (unsigned) flags); + if (!cygheap->root.exists () || posix_pathlen != 1 || posix_path[0] != '/') + { + n = native_pathlen; + real_native_path = native_path; + real_posix_pathlen = chroot_pathlen ?: posix_pathlen; + } + else + { + n = cygheap->root.native_length (); + real_native_path = cygheap->root.native_path (); + real_posix_pathlen = posix_pathlen; + } + memcpy (dst, real_native_path, n + 1); + const char *p = src + real_posix_pathlen; + if (*p == '/') + /* nothing */; + else if ((isdrive (dst) && !dst[2]) || *p) + dst[n++] = '\\'; + fnmunge (dst + n, p); +} + /* conv_to_win32_path: Ensure src_path is a pure Win32 path and store the result in win32_path. @@ -1405,7 +1450,6 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, int src_path_len = strlen (src_path); MALLOC_CHECK; unsigned dummy_flags; - int chroot_ok = !cygheap->root.exists (); devn = FH_BAD; unit = 0; @@ -1511,8 +1555,8 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, return ENOENT; } - int chrooted_path_len; - chrooted_path_len = 0; + int chroot_pathlen; + chroot_pathlen = 0; /* Check the mount table for prefix matches. */ for (i = 0; i < nmounts; i++) { @@ -1529,11 +1573,11 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, else if (cygheap->root.posix_ok (mi->posix_path)) { path = cygheap->root.unchroot (mi->posix_path); - chrooted_path_len = len = strlen (path); + chroot_pathlen = len = strlen (path); } else { - chrooted_path_len = 0; + chroot_pathlen = 0; continue; } @@ -1541,40 +1585,18 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, break; } + bool chroot_ok; + chroot_ok = false; // sigh. stop gcc warning if (i >= nmounts) { backslashify (pathbuf, dst, 0); /* just convert */ set_flags (flags, PATH_BINARY); + chroot_ok = !cygheap->root.exists (); } else { - int n; - const char *native_path; - int posix_pathlen; - if (chroot_ok || chrooted_path_len || mi->posix_pathlen != 1 - || mi->posix_path[0] != '/') - { - n = mi->native_pathlen; - native_path = mi->native_path; - posix_pathlen = chrooted_path_len ?: mi->posix_pathlen; - chroot_ok = 1; - } - else - { - n = cygheap->root.native_length (); - native_path = cygheap->root.native_path (); - posix_pathlen = mi->posix_pathlen; - chroot_ok = 1; - } - memcpy (dst, native_path, n + 1); - const char *p = pathbuf + posix_pathlen; - if (*p == '/') - /* nothing */; - else if ((isdrive (dst) && !dst[2]) || *p) - dst[n++] = '\\'; - strcpy (dst + n, p); - backslashify (dst, dst, 0); - set_flags (flags, (unsigned) mi->flags); + mi->build_win32 (dst, pathbuf, flags, chroot_pathlen); + chroot_ok = true; } if (!isvirtual_dev (devn)) diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h index c9cf6a359..c1ab3d58d 100644 --- a/winsup/cygwin/shared_info.h +++ b/winsup/cygwin/shared_info.h @@ -31,6 +31,8 @@ class mount_item void init (const char *dev, const char *path, unsigned flags); struct mntent *getmntent (); + void fnmunge (char *, const char *); + void build_win32 (char *, const char *, unsigned *, unsigned); }; /* Warning: Decreasing this value will cause cygwin.dll to ignore existing |