aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/mingw.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index f4ae60d41..7ce60139e 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -811,7 +811,7 @@ int utimensat(int fd, const char *path, const struct timespec times[2],
811 HANDLE fh; 811 HANDLE fh;
812 DWORD cflag = FILE_FLAG_BACKUP_SEMANTICS; 812 DWORD cflag = FILE_FLAG_BACKUP_SEMANTICS;
813 813
814 if (!is_absolute_path(path) && fd != AT_FDCWD) { 814 if (is_relative_path(path) && fd != AT_FDCWD) {
815 errno = ENOSYS; // partial implementation 815 errno = ENOSYS; // partial implementation
816 return rc; 816 return rc;
817 } 817 }
@@ -1202,7 +1202,7 @@ int symlink(const char *target, const char *linkpath)
1202 return -1; 1202 return -1;
1203 } 1203 }
1204 1204
1205 if (!is_absolute_path(target) && has_path(linkpath)) { 1205 if (is_relative_path(target) && has_path(linkpath)) {
1206 /* make target's path relative to current directory */ 1206 /* make target's path relative to current directory */
1207 const char *name = bb_get_last_path_component_nostrip(linkpath); 1207 const char *name = bb_get_last_path_component_nostrip(linkpath);
1208 relative = xasprintf("%.*s%s", 1208 relative = xasprintf("%.*s%s",
@@ -2082,11 +2082,11 @@ int has_path(const char *file)
2082 has_dos_drive_prefix(file); 2082 has_dos_drive_prefix(file);
2083} 2083}
2084 2084
2085/* This function is misnamed. It's actually a test for 'is not a path 2085/* Test whether a path is relative to a known location (usually the
2086 * relative to the current working directory'. On Unix this is the 2086 * current working directory or a symlink). On Unix this is a path
2087 * same as 'is an absolute path' but Windows also has paths relative to 2087 * that doesn't start with a slash but on Windows we also need to
2088 * current root and relative to current directory of another drive. */ 2088 * exclude paths that start with a backslash or a drive letter. */
2089int is_absolute_path(const char *path) 2089int is_relative_path(const char *path)
2090{ 2090{
2091 return path[0] == '/' || path[0] == '\\' || has_dos_drive_prefix(path); 2091 return !is_dir_sep(path[0]) && !has_dos_drive_prefix(path);
2092} 2092}