From 4bb5f0163c1cf3c65745ea06f1b42545ecaa35d7 Mon Sep 17 00:00:00 2001 From: Karel Klic Date: Wed, 11 Nov 2009 22:27:52 +0100 Subject: pyhook-helper: uid taken from system instead of command line --- src/Hooks/abrt-pyhook-helper.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/Hooks/abrt-pyhook-helper.cpp') diff --git a/src/Hooks/abrt-pyhook-helper.cpp b/src/Hooks/abrt-pyhook-helper.cpp index 818119a..24f08d3 100644 --- a/src/Hooks/abrt-pyhook-helper.cpp +++ b/src/Hooks/abrt-pyhook-helper.cpp @@ -20,6 +20,7 @@ */ #include +#include /* We can easily get rid of abrtlib (libABRTUtils.so) usage in this file, * but DebugDump will pull it in anyway */ #include "abrtlib.h" @@ -34,7 +35,6 @@ static char *pid; static char *executable; static char *uuid; static char *cmdline; -static char *loginuid; int main(int argc, char** argv) { @@ -45,7 +45,6 @@ int main(int argc, char** argv) { "executable", required_argument, NULL, 'e' }, { "uuid" , required_argument, NULL, 'u' }, { "cmdline" , required_argument, NULL, 'c' }, - { "loginuid" , required_argument, NULL, 'l' }, { 0 }, }; int opt; @@ -65,9 +64,6 @@ int main(int argc, char** argv) case 'c': cmdline = optarg; break; - case 'l': - loginuid = optarg; - break; default: usage: error_msg_and_die( @@ -77,7 +73,6 @@ int main(int argc, char** argv) " -p,--executable PATH absolute path to the program that crashed\n" " -u,--uuid UUID hash generated from the backtrace\n" " -c,--cmdline TEXT command line of the crashed program\n" - " -l,--loginuid UID login UID\n" ); } } @@ -112,8 +107,11 @@ int main(int argc, char** argv) dd.SaveText("cmdline", cmdline); if (uuid) dd.SaveText("uuid", uuid); - if (loginuid) - dd.SaveText("uid", loginuid); + + char uid[16]; + snprintf(uid, 16, "%d", (int)getuid()); + dd.SaveText("uid", uid); + dd.SaveText("backtrace", bt); free(bt); dd.Close(); -- cgit From 08157f4636719a55a0ed05fb95ccbb8fb00d4193 Mon Sep 17 00:00:00 2001 From: Karel Klic Date: Thu, 12 Nov 2009 14:32:40 +0100 Subject: Size of uid depends on sizeof(int) --- src/Hooks/abrt-pyhook-helper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Hooks/abrt-pyhook-helper.cpp') diff --git a/src/Hooks/abrt-pyhook-helper.cpp b/src/Hooks/abrt-pyhook-helper.cpp index 24f08d3..348fbc7 100644 --- a/src/Hooks/abrt-pyhook-helper.cpp +++ b/src/Hooks/abrt-pyhook-helper.cpp @@ -108,8 +108,8 @@ int main(int argc, char** argv) if (uuid) dd.SaveText("uuid", uuid); - char uid[16]; - snprintf(uid, 16, "%d", (int)getuid()); + char uid[sizeof(int) * 3 + 2]; + sprintf(uid, "%d", (int)getuid()); dd.SaveText("uid", uid); dd.SaveText("backtrace", bt); -- cgit