aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-05-27 11:56:52 +0100
committerRon Yorston <rmy@pobox.com>2019-05-27 11:56:52 +0100
commita61949401890cbb33a9d6c4571b51c53460ad438 (patch)
tree64dedaddb89896d5b1670a421af123670ca2120b /coreutils
parent03a7b173605a890e1db5177ecd5b8dd591081c41 (diff)
parentbcb1fc3e6ca6fe902610f507eaf9b0b58a5c583a (diff)
downloadbusybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.tar.gz
busybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.tar.bz2
busybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/dd.c26
-rw-r--r--coreutils/ln.c2
-rw-r--r--coreutils/ls.c2
3 files changed, 15 insertions, 15 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 2d91f77ef..3054ec6ea 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -195,23 +195,15 @@ static void dd_output_status(int UNUSED_PARAM cur_signal)
195#endif 195#endif
196} 196}
197 197
198static ssize_t full_write_or_warn(const void *buf, size_t len,
199 const char *const filename)
200{
201 ssize_t n = full_write(ofd, buf, len);
202 if (n < 0)
203 bb_perror_msg("writing '%s'", filename);
204 return n;
205}
206
207static bool write_and_stats(const void *buf, size_t len, size_t obs, 198static bool write_and_stats(const void *buf, size_t len, size_t obs,
208 const char *filename) 199 const char *filename)
209{ 200{
210 ssize_t n = full_write_or_warn(buf, len, filename); 201 ssize_t n;
211 if (n < 0) 202
212 return 1; 203 n = full_write(ofd, buf, len);
213#if ENABLE_FEATURE_DD_THIRD_STATUS_LINE 204#if ENABLE_FEATURE_DD_THIRD_STATUS_LINE
214 G.total_bytes += n; 205 if (n > 0)
206 G.total_bytes += n;
215#endif 207#endif
216 if ((size_t)n == obs) { 208 if ((size_t)n == obs) {
217 G.out_full++; 209 G.out_full++;
@@ -221,6 +213,14 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs,
221 G.out_part++; 213 G.out_part++;
222 return 0; 214 return 0;
223 } 215 }
216 /* n is < len (and possibly is -1).
217 * Even if n >= 0, errno is usually set correctly.
218 * For example, if writing to block device and getting ENOSPC,
219 * full_write() first sees a short write, then tries to write
220 * the remainder and gets errno set to ENOSPC.
221 * It returns n > 0 (the amount which it did write).
222 */
223 bb_perror_msg("error writing '%s'", filename);
224 return 1; 224 return 1;
225} 225}
226 226
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 3fe2f3f64..afeb0d72d 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -29,7 +29,7 @@
29//usage: "\n -n Don't dereference symlinks - treat like normal file" 29//usage: "\n -n Don't dereference symlinks - treat like normal file"
30//usage: "\n -b Make a backup of the target (if exists) before link operation" 30//usage: "\n -b Make a backup of the target (if exists) before link operation"
31//usage: "\n -S suf Use suffix instead of ~ when making backup files" 31//usage: "\n -S suf Use suffix instead of ~ when making backup files"
32//usage: "\n -T 2nd arg must be a DIR" 32//usage: "\n -T Treat LINK as a file, not DIR"
33//usage: "\n -v Verbose" 33//usage: "\n -v Verbose"
34//usage: 34//usage:
35//usage:#define ln_example_usage 35//usage:#define ln_example_usage
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 6be3eb291..3eff5a949 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -1096,7 +1096,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
1096 static const char ls_longopts[] ALIGN1 = 1096 static const char ls_longopts[] ALIGN1 =
1097 "full-time\0" No_argument "\xff" 1097 "full-time\0" No_argument "\xff"
1098 "group-directories-first\0" No_argument "\xfe" 1098 "group-directories-first\0" No_argument "\xfe"
1099 "color\0" Optional_argument "\xfd" 1099 IF_FEATURE_LS_COLOR("color\0" Optional_argument "\xfd")
1100 ; 1100 ;
1101#endif 1101#endif
1102 1102