aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/chown.c11
-rw-r--r--libbb/copy_file.c4
2 files changed, 8 insertions, 7 deletions
diff --git a/coreutils/chown.c b/coreutils/chown.c
index c6c1260ad..717e4b17a 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -62,8 +62,8 @@ static int FAST_FUNC fileAction(const char *fileName, struct stat *statbuf,
62{ 62{
63#define param (*(struct param_t*)vparam) 63#define param (*(struct param_t*)vparam)
64#define opt option_mask32 64#define opt option_mask32
65 uid_t u = (param.ugid.uid == (uid_t)-1) ? statbuf->st_uid : param.ugid.uid; 65 uid_t u = (param.ugid.uid == (uid_t)-1L) ? statbuf->st_uid : param.ugid.uid;
66 gid_t g = (param.ugid.gid == (gid_t)-1) ? statbuf->st_gid : param.ugid.gid; 66 gid_t g = (param.ugid.gid == (gid_t)-1L) ? statbuf->st_gid : param.ugid.gid;
67 67
68 if (param.chown_func(fileName, u, g) == 0) { 68 if (param.chown_func(fileName, u, g) == 0) {
69 if (OPT_VERBOSE 69 if (OPT_VERBOSE
@@ -75,7 +75,7 @@ static int FAST_FUNC fileAction(const char *fileName, struct stat *statbuf,
75 return TRUE; 75 return TRUE;
76 } 76 }
77 if (!OPT_QUIET) 77 if (!OPT_QUIET)
78 bb_simple_perror_msg(fileName); /* A filename can have % in it... */ 78 bb_simple_perror_msg(fileName);
79 return FALSE; 79 return FALSE;
80#undef opt 80#undef opt
81#undef param 81#undef param
@@ -87,8 +87,9 @@ int chown_main(int argc UNUSED_PARAM, char **argv)
87 int opt, flags; 87 int opt, flags;
88 struct param_t param; 88 struct param_t param;
89 89
90 param.ugid.uid = -1; 90 /* Just -1 might not work: uid_t may be unsigned long */
91 param.ugid.gid = -1; 91 param.ugid.uid = -1L;
92 param.ugid.gid = -1L;
92 93
93#if ENABLE_FEATURE_CHOWN_LONG_OPTIONS 94#if ENABLE_FEATURE_CHOWN_LONG_OPTIONS
94 applet_long_options = chown_longopts; 95 applet_long_options = chown_longopts;
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 6c64fab16..ed765d8f0 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -316,9 +316,9 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
316#endif 316#endif
317 if (bb_copyfd_eof(src_fd, dst_fd) == -1) 317 if (bb_copyfd_eof(src_fd, dst_fd) == -1)
318 retval = -1; 318 retval = -1;
319 /* Ok, writing side I can understand... */ 319 /* Careful with writing... */
320 if (close(dst_fd) < 0) { 320 if (close(dst_fd) < 0) {
321 bb_perror_msg("can't close '%s'", dest); 321 bb_perror_msg("error writing to '%s'", dest);
322 retval = -1; 322 retval = -1;
323 } 323 }
324 /* ...but read size is already checked by bb_copyfd_eof */ 324 /* ...but read size is already checked by bb_copyfd_eof */