* m4/chown.m4 (gl_FUNC_CHOWN): Recognize missing chown.
* lib/chown.c (rpl_chown) [!HAVE_CHOWN]: Always return failure on
mingw.
* lib/lchown.c (lchown) [!HAVE_CHOWN]: Likewise.
* modules/chown (Depends-on): Add errno.
Signed-off-by: Eric Blake <ebb9@byu.net>
+2009-08-31 Eric Blake <ebb9@byu.net>
+
+ chown: avoid compilation warning on mingw
+ * m4/chown.m4 (gl_FUNC_CHOWN): Recognize missing chown.
+ * lib/chown.c (rpl_chown) [!HAVE_CHOWN]: Always return failure on
+ mingw.
+ * lib/lchown.c (lchown) [!HAVE_CHOWN]: Likewise.
+ * modules/chown (Depends-on): Add errno.
+
2009-08-31 Stefano Lattarini <stefano.lattarini@gmail.com> (tiny change)
* gnulib-tool: Fix test whether $CONFIG_SHELL has a working 'echo'
/* provide consistent interface to chown for systems that don't interpret
an ID of -1 as meaning `don't change the corresponding ID'.
- Copyright (C) 1997, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004-2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
int
rpl_chown (const char *file, uid_t uid, gid_t gid)
{
-#if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE
+#if HAVE_CHOWN
+# if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE
if (gid == (gid_t) -1 || uid == (uid_t) -1)
{
struct stat file_stats;
if (uid == (uid_t) -1)
uid = file_stats.st_uid;
}
-#endif
+# endif
-#if CHOWN_MODIFIES_SYMLINK
+# if CHOWN_MODIFIES_SYMLINK
{
/* Handle the case in which the system-supplied chown function
does *not* follow symlinks. Instead, it changes permissions
else if (errno != EACCES)
return -1;
}
-#endif
+# endif
return chown (file, uid, gid);
+
+#else /* !HAVE_CHOWN */
+ errno = EOPNOTSUPP;
+ return -1;
+#endif
}
/* Provide a stub lchown function for systems that lack it.
- Copyright (C) 1998, 1999, 2002, 2004, 2006, 2007 Free Software
- Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2004, 2006, 2007, 2009 Free
+ Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
int
lchown (const char *file, uid_t uid, gid_t gid)
{
-#if ! CHOWN_MODIFIES_SYMLINK
+#if HAVE_CHOWN
+# if ! CHOWN_MODIFIES_SYMLINK
struct stat stats;
if (lstat (file, &stats) == 0 && S_ISLNK (stats.st_mode))
errno = EOPNOTSUPP;
return -1;
}
-#endif
+# endif
return chown (file, uid, gid);
+
+#else /* !HAVE_CHOWN */
+ errno = EOPNOTSUPP;
+ return -1;
+#endif
}
-# serial 18
+# serial 19
# Determine whether we need the chown wrapper.
dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009
AC_REQUIRE([AC_TYPE_UID_T])
AC_REQUIRE([AC_FUNC_CHOWN])
AC_REQUIRE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK])
+ AC_CHECK_FUNCS_ONCE([chown])
if test $ac_cv_func_chown_works = no; then
AC_DEFINE([CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE], [1],
m4/chown.m4
Depends-on:
+errno
open
unistd
sys_stat