If the pre-xfer exec failed with -1, output the strerror()
authorWayne Davison <wayned@samba.org>
Wed, 6 Dec 2006 16:56:19 +0000 (16:56 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 6 Dec 2006 16:56:19 +0000 (16:56 +0000)
from the waitpid() call.

clientserver.c

index 97f4fe11b939896ddd662bd580505907aa58f7a3..b7771251815d63745ea09e43e1fc3acfbd9dd4dd 100644 (file)
@@ -244,7 +244,9 @@ static char *finish_pre_exec(pid_t pid, int fd, char *request,
        if (wait_process(pid, &status, 0) < 0
         || !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
                char *e;
-               if (asprintf(&e, "pre-xfer exec returned failure (%d)\n", status) < 0)
+               if (asprintf(&e, "pre-xfer exec returned failure (%d)%s%s\n",
+                            status, status < 0 ? ": " : "",
+                            status < 0 ? strerror(errno) : "") < 0)
                        out_of_memory("finish_pre_exec");
                return e;
        }