Files
MSYS2-packages/pacman/0001-more-debugging-info.patch
2016-07-15 09:53:31 +03:00

46 lines
1.6 KiB
Diff

diff -Naur pacman-5.0.1-orig/lib/libalpm/util.c pacman-5.0.1/lib/libalpm/util.c
--- pacman-5.0.1-orig/lib/libalpm/util.c 2016-07-15 09:42:21.400037400 +0300
+++ pacman-5.0.1/lib/libalpm/util.c 2016-07-15 09:42:22.245037400 +0300
@@ -300,6 +300,23 @@
return ret;
}
+char *get_command_line(const char* cmd, char *const argv[])
+{
+ size_t len = strlen(cmd) + 1;
+ size_t nargs = 0;
+ while (argv[nargs] != NULL) {
+ len += strlen(argv[nargs++]) + 1;
+ }
+ char *result = malloc(len) + 1;
+ strcpy(result, cmd);
+ strcat(result, " ");
+ for (size_t arg = 0; arg < nargs; ++arg) {
+ strcat(result, argv[arg]);
+ strcat(result, " ");
+ }
+ return result;
+}
+
/** Unpack a list of files in an archive.
* @param handle the context handle
* @param path the archive to unpack
@@ -629,7 +646,7 @@
umask(0022);
execv(cmd, argv);
/* execv only returns if there was an error */
- fprintf(stderr, _("call to execv failed (%s)\n"), strerror(errno));
+ fprintf(stderr, _("call to execv (%s) failed (%s)\n"), get_command_line(cmd, argv), strerror(errno));
exit(1);
} else {
/* this code runs for the parent only (wait on the child) */
@@ -708,7 +725,7 @@
if(WIFEXITED(status)) {
_alpm_log(handle, ALPM_LOG_DEBUG, "call to waitpid succeeded\n");
if(WEXITSTATUS(status) != 0) {
- _alpm_log(handle, ALPM_LOG_ERROR, _("command failed to execute correctly\n"));
+ _alpm_log(handle, ALPM_LOG_ERROR, _("command (%s) failed to execute correctly\n"), get_command_line(cmd, argv));
retval = 1;
}
} else if(WIFSIGNALED(status) != 0) {