aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/fsync.c3
-rw-r--r--coreutils/md5_sha1_sum.c6
-rw-r--r--coreutils/tail.c3
-rw-r--r--coreutils/touch.c4
-rw-r--r--coreutils/wc.c2
5 files changed, 13 insertions, 5 deletions
diff --git a/coreutils/fsync.c b/coreutils/fsync.c
index f00803c5b..53900f8d2 100644
--- a/coreutils/fsync.c
+++ b/coreutils/fsync.c
@@ -7,6 +7,9 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#ifndef O_NOATIME
11# define O_NOATIME 0
12#endif
10 13
11/* This is a NOFORK applet. Be very careful! */ 14/* This is a NOFORK applet. Be very careful! */
12 15
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index a64026d3d..3d50bb0f5 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -101,8 +101,10 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
101 unsigned flags; 101 unsigned flags;
102 /*hash_algo_t hash_algo = applet_name[3];*/ 102 /*hash_algo_t hash_algo = applet_name[3];*/
103 103
104 if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) 104 if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) {
105 flags = getopt32(argv, "scw"); 105 /* -b "binary", -t "text" are ignored (shaNNNsum compat) */
106 flags = getopt32(argv, "scwbt");
107 }
106 else optind = 1; 108 else optind = 1;
107 argv += optind; 109 argv += optind;
108 //argc -= optind; 110 //argc -= optind;
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 0be166315..c9d86f459 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -241,7 +241,8 @@ int tail_main(int argc, char **argv)
241 } while (nwrite); 241 } while (nwrite);
242 } 242 }
243 } 243 }
244 xwrite(STDOUT_FILENO, buf + nread - nwrite, nwrite); 244 if (nwrite > 0)
245 xwrite(STDOUT_FILENO, buf + nread - nwrite, nwrite);
245 } else if (count) { 246 } else if (count) {
246 if (COUNT_BYTES) { 247 if (COUNT_BYTES) {
247 taillen += nread; 248 taillen += nread;
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 3f7b265bd..dceb7c1cc 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -104,7 +104,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
104 } 104 }
105 105
106 do { 106 do {
107 if (utimes(*argv, reference_file ? timebuf : NULL) != 0) { 107 if (utimes(*argv, (reference_file || date_str) ? timebuf : NULL) != 0) {
108 if (errno == ENOENT) { /* no such file */ 108 if (errno == ENOENT) { /* no such file */
109 if (opts) { /* creation is disabled, so ignore */ 109 if (opts) { /* creation is disabled, so ignore */
110 continue; 110 continue;
@@ -113,7 +113,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
113 fd = open(*argv, O_RDWR | O_CREAT, 0666); 113 fd = open(*argv, O_RDWR | O_CREAT, 0666);
114 if (fd >= 0) { 114 if (fd >= 0) {
115 xclose(fd); 115 xclose(fd);
116 if (reference_file) 116 if (reference_file || date_str)
117 utimes(*argv, timebuf); 117 utimes(*argv, timebuf);
118 continue; 118 continue;
119 } 119 }
diff --git a/coreutils/wc.c b/coreutils/wc.c
index 08f3c2dc4..711684225 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -88,6 +88,8 @@ int wc_main(int argc UNUSED_PARAM, char **argv)
88 if (!argv[0]) { 88 if (!argv[0]) {
89 *--argv = (char *) bb_msg_standard_input; 89 *--argv = (char *) bb_msg_standard_input;
90 fname_fmt = "\n"; 90 fname_fmt = "\n";
91 }
92 if (!argv[1]) { /* zero or one filename? */
91 if (!((print_type-1) & print_type)) /* exactly one option? */ 93 if (!((print_type-1) & print_type)) /* exactly one option? */
92 start_fmt = "%"COUNT_FMT; 94 start_fmt = "%"COUNT_FMT;
93 } 95 }