diff options
| author | Andre Noll <maan@tuebingen.mpg.de> | 2017-11-17 16:41:27 +0100 |
|---|---|---|
| committer | Andre Noll <maan@tuebingen.mpg.de> | 2017-11-17 16:44:19 +0100 |
| commit | ffce5ac0f8d17dad30fa0c2fee32aef9eadecf27 (patch) | |
| tree | ce1cd800ebb8181f2987df66c954b93f2b3ea275 | |
| parent | 07ab37b55e1bf4ad7ef65fd25db84fa2a5f50f56 (diff) | |
| parent | 7277dbda6f036a3953d794305cad6a3bc51c67b4 (diff) | |
Merge branch 'refs/heads/t/exit-hook'
A fix for a long standing issue with the exit hook.
Cooking for a week.
* refs/heads/t/exit-hook:
Allow word-splitting for exit hook.
| -rw-r--r-- | NEWS | 9 | ||||
| -rw-r--r-- | dss.c | 19 |
2 files changed, 17 insertions, 11 deletions
@@ -13,23 +13,26 @@ - New option: --mountpoint. If this option is given, dss aborts if no file system is mounted on the destination directory. + - New option --checksum to let rsync compute checksums occasionally. + - The --no-resume option has been removed. - The ls subcommand now shows the age of incomplete snapshots rather than 0:00. - - New option --checksum to let rsync compute checksums occasionally. - - In run mode, dss no longer exits successfully if another instance is already running. - - "make install" will install the executable and the man page. + - The command specified as the argument to --exit-hook is now subject + to word splitting. Previously, the string was executed as-is. - Improved error diagnostics for the kill subcommand. - For all subcommands other than "run", timestamps and function names are omitted from the log output. + - "make install" will install the executable and the man page. + - CFLAGS, CPPFLAGS and LDFLAGS can now be used to override the flags of the build system. @@ -1526,15 +1526,18 @@ out: static void exit_hook(int exit_code) { - const char *argv[3]; pid_t pid; - - argv[0] = OPT_STRING_VAL(DSS, EXIT_HOOK); - argv[1] = dss_strerror(-exit_code); - argv[2] = NULL; - - DSS_NOTICE_LOG(("executing %s %s\n", argv[0], argv[1])); - dss_exec(&pid, argv[0], (char **)argv); + char **argv, *tmp = dss_strdup(OPT_STRING_VAL(DSS, EXIT_HOOK)); + unsigned n = split_args(tmp, &argv, " \t"); + + n++; + argv = dss_realloc(argv, (n + 1) * sizeof(char *)); + argv[n - 1] = dss_strdup(dss_strerror(-exit_code)); + argv[n] = NULL; + dss_exec(&pid, argv[0], argv); + free(argv[n - 1]); + free(argv); + free(tmp); } static void lock_dss_or_die(void) |
