mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-22 23:29:16 +02:00
Use lchmod instead of stat + chown if available
Fallout of the NOFLOOW_SYMLINKS fix from bug 593406
This commit is contained in:
parent
48e0af0157
commit
3826963e65
@ -952,7 +952,7 @@ AC_MSG_RESULT(unsigned $glib_size_type)
|
|||||||
|
|
||||||
# Check for some functions
|
# Check for some functions
|
||||||
AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk)
|
AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk)
|
||||||
AC_CHECK_FUNCS(chown lchown fchmod fchown link statvfs statfs utimes getgrgid getpwuid)
|
AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link statvfs statfs utimes getgrgid getpwuid)
|
||||||
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getmntinfo)
|
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getmntinfo)
|
||||||
# Check for high-resolution sleep functions
|
# Check for high-resolution sleep functions
|
||||||
AC_CHECK_FUNCS(nanosleep nsleep)
|
AC_CHECK_FUNCS(nanosleep nsleep)
|
||||||
|
@ -1881,6 +1881,9 @@ set_unix_mode (char *filename,
|
|||||||
|
|
||||||
#ifdef HAVE_SYMLINK
|
#ifdef HAVE_SYMLINK
|
||||||
if (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) {
|
if (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) {
|
||||||
|
#ifdef HAVE_LCHMOD
|
||||||
|
res = lchmod (filename, val);
|
||||||
|
#else
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
/* Calling chmod on a symlink changes permissions on the symlink.
|
/* Calling chmod on a symlink changes permissions on the symlink.
|
||||||
* We don't want to do this, so we need to check for a symlink */
|
* We don't want to do this, so we need to check for a symlink */
|
||||||
@ -1892,10 +1895,11 @@ set_unix_mode (char *filename,
|
|||||||
_("Cannot set permissions on symlinks"));
|
_("Cannot set permissions on symlinks"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
else if (res == 0)
|
||||||
|
res = g_chmod (filename, val);
|
||||||
|
#endif
|
||||||
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (res == 0)
|
|
||||||
res = g_chmod (filename, val);
|
res = g_chmod (filename, val);
|
||||||
|
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user