diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-08 17:54:47 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-08 17:54:47 +0000 |
commit | 7039a66b58706457c7423de60556e04545432943 (patch) | |
tree | a512daebc3674c819766664c8ea17d41ef7fef02 /coreutils/dd.c | |
parent | 1385899416a4396385ad421ae1f532be7103738a (diff) | |
download | busybox-w32-7039a66b58706457c7423de60556e04545432943.tar.gz busybox-w32-7039a66b58706457c7423de60556e04545432943.tar.bz2 busybox-w32-7039a66b58706457c7423de60556e04545432943.zip |
correct largefile support, add comments about it.
Diffstat (limited to 'coreutils/dd.c')
-rw-r--r-- | coreutils/dd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index d557ae46d..d60192e7c 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -25,12 +25,12 @@ static const struct suffix_mult dd_suffixes[] = { | |||
25 | { NULL, 0 } | 25 | { NULL, 0 } |
26 | }; | 26 | }; |
27 | 27 | ||
28 | static FILEOFF_TYPE out_full, out_part, in_full, in_part; | 28 | static off_t out_full, out_part, in_full, in_part; |
29 | 29 | ||
30 | static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal) | 30 | static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal) |
31 | { | 31 | { |
32 | bb_fprintf(stderr, FILEOFF_FMT"+"FILEOFF_FMT" records in\n" | 32 | bb_fprintf(stderr, OFF_FMT"+"OFF_FMT" records in\n" |
33 | FILEOFF_FMT"+"FILEOFF_FMT" records out\n", | 33 | OFF_FMT"+"OFF_FMT" records out\n", |
34 | in_full, in_part, | 34 | in_full, in_part, |
35 | out_full, out_part); | 35 | out_full, out_part); |
36 | } | 36 | } |
@@ -44,7 +44,7 @@ int dd_main(int argc, char **argv) | |||
44 | int flags = trunc_flag; | 44 | int flags = trunc_flag; |
45 | size_t oc = 0, ibs = 512, obs = 512; | 45 | size_t oc = 0, ibs = 512, obs = 512; |
46 | ssize_t n; | 46 | ssize_t n; |
47 | FILEOFF_TYPE seek = 0, skip = 0, count = MAX_FILEOFF_TYPE; | 47 | off_t seek = 0, skip = 0, count = OFF_T_MAX; |
48 | int oflag, ifd, ofd; | 48 | int oflag, ifd, ofd; |
49 | const char *infile = NULL, *outfile = NULL; | 49 | const char *infile = NULL, *outfile = NULL; |
50 | char *ibuf, *obuf; | 50 | char *ibuf, *obuf; |
@@ -108,14 +108,14 @@ int dd_main(int argc, char **argv) | |||
108 | obuf = ibuf; | 108 | obuf = ibuf; |
109 | 109 | ||
110 | if (infile != NULL) | 110 | if (infile != NULL) |
111 | ifd = xopen(infile, O_RDONLY | (O_LARGEFILE * ENABLE_LFS)); | 111 | ifd = xopen(infile, O_RDONLY); |
112 | else { | 112 | else { |
113 | ifd = STDIN_FILENO; | 113 | ifd = STDIN_FILENO; |
114 | infile = bb_msg_standard_input; | 114 | infile = bb_msg_standard_input; |
115 | } | 115 | } |
116 | 116 | ||
117 | if (outfile != NULL) { | 117 | if (outfile != NULL) { |
118 | oflag = O_WRONLY | O_CREAT | (O_LARGEFILE * ENABLE_LFS); | 118 | oflag = O_WRONLY | O_CREAT; |
119 | 119 | ||
120 | if (!seek && (flags & trunc_flag)) | 120 | if (!seek && (flags & trunc_flag)) |
121 | oflag |= O_TRUNC; | 121 | oflag |= O_TRUNC; |
@@ -137,7 +137,7 @@ int dd_main(int argc, char **argv) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | if (skip) { | 139 | if (skip) { |
140 | if (LSEEK(ifd, skip * ibs, SEEK_CUR) < 0) { | 140 | if (lseek(ifd, skip * ibs, SEEK_CUR) < 0) { |
141 | while (skip-- > 0) { | 141 | while (skip-- > 0) { |
142 | n = safe_read(ifd, ibuf, ibs); | 142 | n = safe_read(ifd, ibuf, ibs); |
143 | if (n < 0) | 143 | if (n < 0) |
@@ -149,7 +149,7 @@ int dd_main(int argc, char **argv) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | if (seek) { | 151 | if (seek) { |
152 | if (LSEEK(ofd, seek * obs, SEEK_CUR) < 0) | 152 | if (lseek(ofd, seek * obs, SEEK_CUR) < 0) |
153 | goto die_outfile; | 153 | goto die_outfile; |
154 | } | 154 | } |
155 | 155 | ||