Hi!

Thanks again for patiently reviewing this patch.

On Fri, 2015-03-06 at 15:36 +0100, Bernhard Reutner-Fischer wrote:
> >+int truncate_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
> >+int truncate_main(int argc UNUSED_PARAM, char **argv) {
> >+    unsigned opts;
> >+    int flags = O_RDWR;
> >+    int fd;
> 
> I'd move int FD down into the loop, fwiw.
> int ret = EXIT_SUCCESS;
> instead, see below.

Thanks, done, will be in v7 with the other changes.

> >+    argv += optind;
> >+    while (*argv) {
> >+            fd = xopen(*argv, flags);
> >+            if (ftruncate(fd, size) == -1)
> >+                    bb_perror_msg_and_die("ftruncate");
> 
> Since we can have multiple files, I would
> if (ftruncate(fd, size) == -1) {
>   bb_perror_msg("ftruncate");
>   ret = EXIT_FAILURE;
> or even mention the affected file in the perror.
> }

Done. Made it mention the filename as otherwise the error message might
not be that useful: bb_perror_msg("ftruncate(%s)", *argv). Hopefully
that will do even though, strictly speaking, ftruncate takes a file
descriptor.

> >+            xclose(fd);
> >+            ++argv;
> >+    }
> >+
> >+    return 0;
> 
> return ret;

Done. Thank you.

Best regards,
Ari Sundholm
[email protected]

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to