Ensure a proper exit code

If copy() fails at least print stats.
This commit is contained in:
sin 2014-06-04 13:02:07 +01:00
parent 7fa098ace6
commit 144a893268

4
dd.c
View File

@ -263,10 +263,10 @@ main(int argc, char *argv[])
signal(SIGINT, sig_int); signal(SIGINT, sig_int);
if (copy(&config) < 0) if (copy(&config) < 0)
eprintf("copy:"); weprintf("copy:");
print_stat(&config); print_stat(&config);
if (config.nosync == 0) if (config.nosync == 0)
sync(); sync(); sync(); sync();
return EXIT_SUCCESS; return config.saved_errno;
} }