Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2008-12-20 06:51:59 +0100
committerDan McGee <dan@archlinux.org>2009-09-06 16:17:17 -0500
commitc88ac86292a9cd9b87ab9ebf203b9eca75af1f28 (patch)
treee79968b7836c536c4c5302aeef225ed868fa0d0a
parent6e1b1aea5908fba6669b31a0a92f934a6a2aa244 (diff)
Log commandline in pacman/alpm log
This implements FS#11452. Original-work-by: silvio <silvio@port1024.net> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--src/pacman/pacman.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 6e5147c5..37472083 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -957,6 +957,29 @@ static int parseconfig(const char *file)
return(_parseconfig(file, NULL, NULL));
}
+/** print commandline to logfile
+ */
+static void cl_to_log(int argc, char* argv[])
+{
+ size_t size = 0;
+ int i;
+ for(i = 0; i<argc; i++) {
+ size += strlen(argv[i]) + 1;
+ }
+ char *cl_text = malloc(size);
+ if(!cl_text)
+ return;
+ char *p = cl_text;
+ for(i = 0; i<argc-1; i++) {
+ strcpy(p, argv[i]);
+ p += strlen(argv[i]);
+ *p++ = ' ';
+ }
+ strcpy(p, argv[i]);
+ alpm_logaction("Running '%s'\n", cl_text);
+ free(cl_text);
+}
+
/** Main function.
* @param argc argc
* @param argv argv
@@ -1083,6 +1106,11 @@ int main(int argc, char *argv[])
cleanup(EXIT_FAILURE);
}
+ /* Log commandline */
+ if(needs_root()) {
+ cl_to_log(argc, argv);
+ }
+
/* start the requested operation */
switch(config->op) {
case PM_OP_REMOVE: