cosmetic fixes
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 6 Feb 2010 20:11:49 +0000 (21:11 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 6 Feb 2010 20:11:49 +0000 (21:11 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/chown.c
libbb/copy_file.c

index c6c1260ad6a0ccc107b02acce64ce92307ff82cf..717e4b17aade55c849796de32e861e08840b661d 100644 (file)
@@ -62,8 +62,8 @@ static int FAST_FUNC fileAction(const char *fileName, struct stat *statbuf,
 {
 #define param  (*(struct param_t*)vparam)
 #define opt option_mask32
-       uid_t u = (param.ugid.uid == (uid_t)-1) ? statbuf->st_uid : param.ugid.uid;
-       gid_t g = (param.ugid.gid == (gid_t)-1) ? statbuf->st_gid : param.ugid.gid;
+       uid_t u = (param.ugid.uid == (uid_t)-1L) ? statbuf->st_uid : param.ugid.uid;
+       gid_t g = (param.ugid.gid == (gid_t)-1L) ? statbuf->st_gid : param.ugid.gid;
 
        if (param.chown_func(fileName, u, g) == 0) {
                if (OPT_VERBOSE
@@ -75,7 +75,7 @@ static int FAST_FUNC fileAction(const char *fileName, struct stat *statbuf,
                return TRUE;
        }
        if (!OPT_QUIET)
-               bb_simple_perror_msg(fileName); /* A filename can have % in it... */
+               bb_simple_perror_msg(fileName);
        return FALSE;
 #undef opt
 #undef param
@@ -87,8 +87,9 @@ int chown_main(int argc UNUSED_PARAM, char **argv)
        int opt, flags;
        struct param_t param;
 
-       param.ugid.uid = -1;
-       param.ugid.gid = -1;
+       /* Just -1 might not work: uid_t may be unsigned long */
+       param.ugid.uid = -1L;
+       param.ugid.gid = -1L;
 
 #if ENABLE_FEATURE_CHOWN_LONG_OPTIONS
        applet_long_options = chown_longopts;
index 6c64fab1650b676f13555c332ff3f1707707dc68..ed765d8f0c4b6bccdfd40bbb4ddded90e2052737 100644 (file)
@@ -316,9 +316,9 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
 #endif
                if (bb_copyfd_eof(src_fd, dst_fd) == -1)
                        retval = -1;
-               /* Ok, writing side I can understand... */
+               /* Careful with writing... */
                if (close(dst_fd) < 0) {
-                       bb_perror_msg("can't close '%s'", dest);
+                       bb_perror_msg("error writing to '%s'", dest);
                        retval = -1;
                }
                /* ...but read size is already checked by bb_copyfd_eof */