From 29cb39c4ff6d7b0b43dbbadde1bb14f3be62a188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 21 Jun 2007 18:40:33 +0000 Subject: [PATCH] actually exit with an error when it happens git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21484 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/mimeset.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/bin/mimeset.cpp b/src/bin/mimeset.cpp index 8d03e6f9dc..3ac521c98c 100644 --- a/src/bin/mimeset.cpp +++ b/src/bin/mimeset.cpp @@ -39,7 +39,7 @@ usage(int status) } -void +status_t process_file(const char *path) { status_t status = B_OK; @@ -57,6 +57,7 @@ process_file(const char *path) fprintf(stderr, "%s: \"%s\": %s\n", sProgramName, path, strerror(status)); } + return status; } @@ -94,6 +95,7 @@ main(int argc, char **argv) BApplication app("application/x-vnd.haiku.mimeset"); + int err = 0; while (*argv) { char *arg = *argv++; @@ -103,10 +105,15 @@ main(int argc, char **argv) while (fgets(name, sizeof(name), stdin) != NULL) { name[strlen(name) - 1] = '\0'; // remove trailing '\n' - process_file(name); + err = process_file(name); + if (err) + exit(err); } - } else - process_file(arg); + } else { + err = process_file(arg); + if (err) + exit(err); + } } return 0;