Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmirror may abort on various error conditions. There was a complaint, that the error mesasge might be overlooked because of the normal diagnostic output: buczek@theinternet:~$ cmirror /tmp/a /tmp/b --delete theinternet.molgen.mpg.de: creating empty ./1 theinternet.molgen.mpg.de: creating empty ./10 theinternet.molgen.mpg.de: creating empty ./2 theinternet.molgen.mpg.de: creating empty ./3 theinternet.molgen.mpg.de: creating empty ./4 theinternet.molgen.mpg.de: creating empty ./5 theinternet.molgen.mpg.de: creating empty ./6 theinternet.molgen.mpg.de: creating empty ./7 theinternet.molgen.mpg.de: creating empty ./8 theinternet.molgen.mpg.de: creating empty ./9 theinternet.molgen.mpg.de: rm -r ./xx rm: cannot remove './xx/aa': Permission denied buczek@theinternet:~$ To make this more clear, an additional diagnostic output was requested to show that cmirror didn't finish its job: buczek@theinternet:~$ cmirror /tmp/a /tmp/b --delete theinternet.molgen.mpg.de: creating empty ./1 theinternet.molgen.mpg.de: creating empty ./10 theinternet.molgen.mpg.de: creating empty ./2 theinternet.molgen.mpg.de: creating empty ./3 theinternet.molgen.mpg.de: creating empty ./4 theinternet.molgen.mpg.de: creating empty ./5 theinternet.molgen.mpg.de: creating empty ./6 theinternet.molgen.mpg.de: creating empty ./7 theinternet.molgen.mpg.de: creating empty ./8 theinternet.molgen.mpg.de: creating empty ./9 theinternet.molgen.mpg.de: rm -r ./xx rm: cannot remove './xx/aa': Permission denied cmirror aborted buczek@theinternet:~$ Implementation: - Add code to `die()` to optionally show the additional message. This can be selected by a global flag - Let the master set that flag unless `--quiet` is selected - Add code to `die()` so that it can be called with `die(NULL)` to show only the optional additional message but no specific error message. - Replace `_exit(1)` with `die(NULL)` n places where it was used to abort the parent process after a child process, which as the duty to emit the error messages for its operation, has failed.
- Loading branch information