aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-02-05 15:28:54 +0000
committerkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-02-05 15:28:54 +0000
commitda01eb57dde6fe0bf4cd6b8cf0cf7d657d593ede (patch)
treef75b9dafaac15a878b49aaa6c58af6787e8d52c8
parent85b6c633422a94ff86e5e0db4f844850c02750eb (diff)
downloadbusybox-w32-da01eb57dde6fe0bf4cd6b8cf0cf7d657d593ede.tar.gz
busybox-w32-da01eb57dde6fe0bf4cd6b8cf0cf7d657d593ede.tar.bz2
busybox-w32-da01eb57dde6fe0bf4cd6b8cf0cf7d657d593ede.zip
* fileutils/dd.c (dd_main): Ignore ftruncate error if the output is not a
file or directory. git-svn-id: svn://busybox.net/trunk/busybox@4186 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--coreutils/dd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 818ab777e..09e6cccc7 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <sys/types.h> 24#include <sys/types.h>
25#include <sys/stat.h>
25#include <stdlib.h> 26#include <stdlib.h>
26#include <stdio.h> 27#include <stdio.h>
27#include <unistd.h> 28#include <unistd.h>
@@ -106,8 +107,13 @@ int dd_main(int argc, char **argv)
106 perror_msg_and_die("%s", outfile); 107 perror_msg_and_die("%s", outfile);
107 108
108 if (seek && trunc) { 109 if (seek && trunc) {
109 if (ftruncate(ofd, seek * bs) < 0) 110 if (ftruncate(ofd, seek * bs) < 0) {
110 perror_msg_and_die("%s", outfile); 111 struct stat st;
112
113 if (fstat (ofd, &st) < 0 || S_ISREG (st.st_mode) ||
114 S_ISDIR (st.st_mode))
115 perror_msg_and_die("%s", outfile);
116 }
111 } 117 }
112 } else { 118 } else {
113 ofd = STDOUT_FILENO; 119 ofd = STDOUT_FILENO;