summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2005-07-09 21:42:54 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2005-07-09 21:42:54 (GMT)
commit674ed483d8afb3aedacc747f5359bf5f98b5b30a (patch)
treed928f0924f18173eaaaac6b47197ad43c4a35765
parentc2403d9926ea4fb490464d2cb229897817838b53 (diff)
downloadflock-674ed483d8afb3aedacc747f5359bf5f98b5b30a.zip
flock-674ed483d8afb3aedacc747f5359bf5f98b5b30a.tar.gz
flock-674ed483d8afb3aedacc747f5359bf5f98b5b30a.tar.bz2
flock-674ed483d8afb3aedacc747f5359bf5f98b5b30a.tar.xz
Better error messages on execvp failure
-rw-r--r--flock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/flock.c b/flock.c
index 36f1912..649903a 100644
--- a/flock.c
+++ b/flock.c
@@ -251,8 +251,11 @@ int main(int argc, char *argv[])
} else if ( f == 0 ) {
if ( do_close )
close(fd);
+ err = errno;
execvp(cmd_argv[0], cmd_argv);
- _exit(EX_UNAVAILABLE); /* execvp() failed */
+ /* execvp() failed */
+ fprintf(stderr, "%s: %s: %s\n", program, cmd_argv[0], strerror(err));
+ _exit((err == ENOMEM) ? EX_OSERR: EX_UNAVAILABLE);
} else {
do {
w = waitpid(f, &status, 0);