aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-08-12 14:13:07 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-08-12 14:13:07 +0200
commite8e518ce87570586c2a7f7b84ebaead05b2b89a5 (patch)
tree45437313783f76deac367de75eda10881ae942fb
parentef3bfba879fb11d88580ffbdcf2f25dae21fa9fd (diff)
downloadallocbench-e8e518ce87570586c2a7f7b84ebaead05b2b89a5.tar.gz
allocbench-e8e518ce87570586c2a7f7b84ebaead05b2b89a5.zip
improve exec
fix usage print message if exec failed and exit with exit code 1
-rw-r--r--src/exec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/exec.c b/src/exec.c
index 37ef5b6..4397992 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -5,8 +5,8 @@
#include <unistd.h>
int main(int argc, char* argv[]) {
- if (argc < 3) {
- printf("Usage: %s [-p LD_PRELOAD] [-l LD_LIBRARY_PATH] <cmd> [cmd args]\n");
+ if (argc < 2) {
+ printf("Usage: %s [-p LD_PRELOAD] [-l LD_LIBRARY_PATH] <cmd> [cmd args]\n", argv[0]);
printf("\tset LD_PRELOAD to ld_preload and call execvp <cmd> [cmd args]\n");
return 1;
}
@@ -29,4 +29,8 @@ int main(int argc, char* argv[]) {
// Run cmd.
execvp(argv[i], &argv[i]);
+
+ fprintf(stderr, "executing %s failed\n", argv[i]);
+
+ return 1;
}