diff --git a/src/qtpaths/qtpaths.cpp b/src/qtpaths/qtpaths.cpp
index 74534e86ae398347d32c1ff7a05a47bd367d940e..91941558bd49ac77f1e286185190d92c1795f580 100644
--- a/src/qtpaths/qtpaths.cpp
+++ b/src/qtpaths/qtpaths.cpp
@@ -64,7 +64,7 @@ static void message(const QString &string)
 Q_NORETURN static void error(const QString &message)
 {
     fprintf(stderr, "%s\n", qPrintable(message));
-    ::exit(1);
+    ::exit(EXIT_FAILURE);
 }
 
 
@@ -285,10 +285,13 @@ int main(int argc, char **argv)
     if (results.isEmpty()) {
         parser.showHelp();
     } else if (results.size() == 1) {
-        message(results.first());
+        const QString &item = results.first();
+        message(item);
+        if (item.isEmpty())
+            return EXIT_FAILURE;
     } else {
         QString errorMessage = QCoreApplication::translate("qtpaths", "Several options given, only one is supported at a time.");
         error(errorMessage);
     }
-    return 0;
+    return EXIT_SUCCESS;
 }