fxlink: add a message if `cp` fails

This commit is contained in:
Lephenixnoir 2022-08-03 21:49:42 +01:00
parent 6032ce38cf
commit dd6cd3fcd4
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 9 additions and 1 deletions

View File

@ -354,7 +354,15 @@ int main_send(filter_t *filter, delay_t *delay, char **files)
goto end;
}
else {
waitpid(pid, NULL, 0);
int wstatus;
waitpid(pid, &wstatus, 0);
if(!WIFEXITED(wstatus))
err("process did not terminate normally");
else if(WEXITSTATUS(wstatus) != 0) {
err("process terminated with error %d",
WEXITSTATUS(wstatus));
}
}
/* Unmount the filesystem and eject the device if we mounted it */