diff options
Diffstat (limited to 'source/lib/smbrun.c')
-rw-r--r-- | source/lib/smbrun.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/lib/smbrun.c b/source/lib/smbrun.c index 366657129de..5a016cd5cd8 100644 --- a/source/lib/smbrun.c +++ b/source/lib/smbrun.c @@ -80,7 +80,8 @@ if shared is not set then open the file with O_EXCL set ****************************************************************************/ int smbrun(char *cmd,char *outfile,BOOL shared) { - int fd,pid; + int fd; + pid_t pid; uid_t uid = current_user.uid; gid_t gid = current_user.gid; @@ -149,9 +150,14 @@ int smbrun(char *cmd,char *outfile,BOOL shared) CatchChild(); if (wpid != pid) { - DEBUG(2,("waitpid(%d) : %s\n",pid,strerror(errno))); + DEBUG(2,("waitpid(%d) : %s\n",(int)pid,strerror(errno))); return -1; } +#if defined(WIFEXITED) && defined(WEXITSTATUS) + if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } +#endif return status; } |