aboutsummaryrefslogtreecommitdiff
path: root/dd.c
diff options
context:
space:
mode:
Diffstat (limited to 'dd.c')
-rw-r--r--dd.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/dd.c b/dd.c
index f40dec712..d50cf746b 100644
--- a/dd.c
+++ b/dd.c
@@ -125,9 +125,12 @@ extern int dd_main(int argc, char **argv)
125 inFd = open(inFile, 0); 125 inFd = open(inFile, 0);
126 126
127 if (inFd < 0) { 127 if (inFd < 0) {
128 perror(inFile); 128 /* Note that we are not freeing buf or closing
129 free(buf); 129 * files here to save a few bytes. This exits
130 exit(FALSE); 130 * here anyways... */
131
132 /* free(buf); */
133 fatalError( inFile);
131 } 134 }
132 135
133 if (outFile == NULL) 136 if (outFile == NULL)
@@ -136,10 +139,13 @@ extern int dd_main(int argc, char **argv)
136 outFd = open(outFile, O_WRONLY | O_CREAT | O_TRUNC, 0666); 139 outFd = open(outFile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
137 140
138 if (outFd < 0) { 141 if (outFd < 0) {
139 perror(outFile); 142 /* Note that we are not freeing buf or closing
140 close(inFd); 143 * files here to save a few bytes. This exits
141 free(buf); 144 * here anyways... */
142 exit(FALSE); 145
146 /* close(inFd);
147 free(buf); */
148 fatalError( outFile);
143 } 149 }
144 150
145 lseek(inFd, skipBlocks * blockSize, SEEK_SET); 151 lseek(inFd, skipBlocks * blockSize, SEEK_SET);
@@ -180,9 +186,13 @@ extern int dd_main(int argc, char **argv)
180 perror(inFile); 186 perror(inFile);
181 187
182 cleanup: 188 cleanup:
189 /* Note that we are not freeing memory or closing
190 * files here, to save a few bytes. */
191#if 0
183 close(inFd); 192 close(inFd);
184 close(outFd); 193 close(outFd);
185 free(buf); 194 free(buf);
195#endif
186 196
187 printf("%ld+%d records in\n", (long) (intotal / blockSize), 197 printf("%ld+%d records in\n", (long) (intotal / blockSize),
188 (intotal % blockSize) != 0); 198 (intotal % blockSize) != 0);