diff options
Diffstat (limited to 'src/fcopy/main.c')
-rw-r--r-- | src/fcopy/main.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/fcopy/main.c b/src/fcopy/main.c index a41df52a1..d863b537b 100644 --- a/src/fcopy/main.c +++ b/src/fcopy/main.c | |||
@@ -268,16 +268,14 @@ static int fs_copydir(const char *infname, const struct stat *st, int ftype, str | |||
268 | first = 0; | 268 | first = 0; |
269 | else if (!arg_quiet) | 269 | else if (!arg_quiet) |
270 | fprintf(stderr, "Warning fcopy: skipping %s, file already present\n", infname); | 270 | fprintf(stderr, "Warning fcopy: skipping %s, file already present\n", infname); |
271 | free(outfname); | 271 | goto out; |
272 | return 0; | ||
273 | } | 272 | } |
274 | 273 | ||
275 | // extract mode and ownership | 274 | // extract mode and ownership |
276 | if (stat(infname, &s) != 0) { | 275 | if (stat(infname, &s) != 0) { |
277 | if (!arg_quiet) | 276 | if (!arg_quiet) |
278 | fprintf(stderr, "Warning fcopy: skipping %s, cannot find inode\n", infname); | 277 | fprintf(stderr, "Warning fcopy: skipping %s, cannot find inode\n", infname); |
279 | free(outfname); | 278 | goto out; |
280 | return 0; | ||
281 | } | 279 | } |
282 | uid_t uid = s.st_uid; | 280 | uid_t uid = s.st_uid; |
283 | gid_t gid = s.st_gid; | 281 | gid_t gid = s.st_gid; |
@@ -287,8 +285,7 @@ static int fs_copydir(const char *infname, const struct stat *st, int ftype, str | |||
287 | if ((s.st_size + size_cnt) > copy_limit) { | 285 | if ((s.st_size + size_cnt) > copy_limit) { |
288 | fprintf(stderr, "Error fcopy: size limit of %lu MB reached\n", (copy_limit / 1024) / 1024); | 286 | fprintf(stderr, "Error fcopy: size limit of %lu MB reached\n", (copy_limit / 1024) / 1024); |
289 | size_limit_reached = 1; | 287 | size_limit_reached = 1; |
290 | free(outfname); | 288 | goto out; |
291 | return 0; | ||
292 | } | 289 | } |
293 | 290 | ||
294 | file_cnt++; | 291 | file_cnt++; |
@@ -303,7 +300,8 @@ static int fs_copydir(const char *infname, const struct stat *st, int ftype, str | |||
303 | else if (ftype == FTW_SL) { | 300 | else if (ftype == FTW_SL) { |
304 | copy_link(infname, outfname, mode, uid, gid); | 301 | copy_link(infname, outfname, mode, uid, gid); |
305 | } | 302 | } |
306 | 303 | out: | |
304 | free(outfname); | ||
307 | return(0); | 305 | return(0); |
308 | } | 306 | } |
309 | 307 | ||
@@ -336,6 +334,7 @@ static char *check(const char *src) { | |||
336 | return rsrc; // normal exit from the function | 334 | return rsrc; // normal exit from the function |
337 | 335 | ||
338 | errexit: | 336 | errexit: |
337 | free(rsrc); | ||
339 | fprintf(stderr, "Error fcopy: invalid file %s\n", src); | 338 | fprintf(stderr, "Error fcopy: invalid file %s\n", src); |
340 | exit(1); | 339 | exit(1); |
341 | } | 340 | } |