diff options
author | Christopher Faylor <me@cgf.cx> | 2000-07-17 19:18:21 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-07-17 19:18:21 +0000 |
commit | 5bc584ba65db809b22dd2e10eb2cef922ca60d26 (patch) | |
tree | 8248ba57d925f599c0d3fbfb7a7ba6bf8273350a /winsup/cygwin/path.h | |
parent | 17811f7bbe8480acfb8b6ef7ad8dcfa5f2819515 (diff) | |
download | cygnal-5bc584ba65db809b22dd2e10eb2cef922ca60d26.tar.gz cygnal-5bc584ba65db809b22dd2e10eb2cef922ca60d26.tar.bz2 cygnal-5bc584ba65db809b22dd2e10eb2cef922ca60d26.zip |
Throughout, eliminate third argument to path_conv and use new PC_* constants
for second argument.
* path.h: Generalize SYMLINK_* constants to PC_*.
(path_conv): Create a new method. Fold third argument into second.
* dll_init.cc (dll_list::alloc): Try harder to find space to allocate dll
struct.
(dll_dllcrt0): Don't check sanity if we've already called dll_crt0.
* path.cc (path_conv::check): Don't check for a null or empty path unless
specifically told with a flag setting.
(check_null_empty_path): New function, adapted from macro.
* syscalls.cc (_rename): Use already-determined file attributes rather than
checking again.
* lib/cygwin/cygwin_attach.dll.c (cygwin_attach_dll): Use a static per_process
structure since this is apparently supposed to be zeroed.
* lib/cygwin_crt0.c (cygwin_crt0): Zero per_process structure sent to older
DLLs.
Diffstat (limited to 'winsup/cygwin/path.h')
-rw-r--r-- | winsup/cygwin/path.h | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 76ab20805..a2b647bec 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -15,17 +15,21 @@ struct suffix_info suffix_info (const char *s, int addit = 0) {name = s, addon = addit;} }; -enum symlink_follow +enum pathconv_arg { - SYMLINK_FOLLOW, - SYMLINK_NOFOLLOW, - SYMLINK_IGNORE, - SYMLINK_CONTENTS + PC_SYM_FOLLOW = 0x0001, + PC_SYM_NOFOLLOW = 0x0002, + PC_SYM_IGNORE = 0x0004, + PC_SYM_CONTENTS = 0x0008, + PC_FULL = 0x0010, + PC_NULLEMPTY = 0x0020 }; +#define PC_NONULLEMPTY -1 + #include <sys/mount.h> -enum +enum path_types { PATH_NOTHING = 0, PATH_SYMLINK = MOUNT_SYMLINK, @@ -36,7 +40,6 @@ enum PATH_HASACLS = 0x80000000 }; - class path_conv { char path[MAX_PATH]; @@ -65,12 +68,19 @@ class path_conv DWORD fileattr; - void check (const char *src, symlink_follow follow_mode = SYMLINK_FOLLOW, - int use_full_path = 0, const suffix_info *suffixes = NULL); - path_conv (const char *src, symlink_follow follow_mode = SYMLINK_FOLLOW, - int use_full_path = 0, const suffix_info *suffixes = NULL) + void check (const char *src, unsigned opt = PC_SYM_FOLLOW, + const suffix_info *suffixes = NULL); + + path_conv (int, const char *src, unsigned opt = PC_SYM_FOLLOW, + const suffix_info *suffixes = NULL) + { + check (src, opt, suffixes); + } + + path_conv (const char *src, unsigned opt = PC_SYM_FOLLOW, + const suffix_info *suffixes = NULL) { - check (src, follow_mode, use_full_path, suffixes); + check (src, opt | PC_NULLEMPTY, suffixes); } path_conv (): path_flags (0), known_suffix (NULL), error (0), devn (0), unit (0), fileattr (0xffffffff) {path[0] = '\0';} @@ -96,10 +106,9 @@ extern suffix_info std_suffixes[]; int __stdcall get_device_number (const char *name, int &unit, BOOL from_conv = FALSE); int __stdcall slash_unc_prefix_p (const char *path); +int __stdcall check_null_empty_path (const char *name); /* Common macros for checking for invalid path names */ -#define check_null_empty_path(src) \ - (!(src) ? EFAULT : *(src) ? 0 : ENOENT) #define check_null_empty_path_errno(src) \ ({ \ |