diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2011-04-18 21:14:47 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-04-18 21:14:47 +0200 |
commit | f5ba5aab2ad2cbf3b7f3b27e2a9aec3e086dc0f3 (patch) | |
tree | 4271f55891ed7570ccf065f33f59ba6e0496c702 /src | |
parent | 46caacf049b52bde5a35c2d861dda71dfeddd346 (diff) | |
download | abrt-f5ba5aab2ad2cbf3b7f3b27e2a9aec3e086dc0f3.tar.gz abrt-f5ba5aab2ad2cbf3b7f3b27e2a9aec3e086dc0f3.tar.xz abrt-f5ba5aab2ad2cbf3b7f3b27e2a9aec3e086dc0f3.zip |
abrt-hook-ccpp: simpler way to pass old core pattern
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/hooks/abrt-hook-ccpp.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c index 8be24b9b..dfccee74 100644 --- a/src/hooks/abrt-hook-ccpp.c +++ b/src/hooks/abrt-hook-ccpp.c @@ -308,7 +308,9 @@ int main(int argc, char** argv) { /* percent specifier: %s %c %p %u %g %t %h %e */ /* argv: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] */ - error_msg_and_die("Usage: %s DUMPDIR SIGNO CORE_SIZE_LIMIT PID UID GID TIME HOSTNAME BINARY_NAME [OLD_PATTERN]", argv[0]); + // [OLD_PATTERN] is deprecated, so removing it from help: + //error_msg_and_die("Usage: %s DUMPDIR SIGNO CORE_SIZE_LIMIT PID UID GID TIME HOSTNAME BINARY_NAME [OLD_PATTERN]", argv[0]); + error_msg_and_die("Usage: %s DUMPDIR SIGNO CORE_SIZE_LIMIT PID UID GID TIME HOSTNAME BINARY_NAME", argv[0]); } /* Not needed on 2.6.30. @@ -345,7 +347,20 @@ int main(int argc, char** argv) { perror_msg_and_die("pid '%s' or limit '%s' is bogus", argv[4], argv[3]); } - if (argv[10]) /* OLD_PATTERN */ + + FILE *saved_core_pattern = fopen(VAR_RUN"/abrt/saved_core_pattern", "r"); + if (saved_core_pattern) + { + char *s = xmalloc_fgetline(saved_core_pattern); + fclose(saved_core_pattern); + /* If we have a saved pattern and it's not a "|PROG ARGS" thing... */ + if (s && s[0] != '|') + { + core_basename = s; + argv[10] = NULL; /* don't use old way to pass OLD_PATTERN */ + } + } + if (argv[10]) /* OLD_PATTERN (deprecated) */ { char *buf = (char*) xzalloc(strlen(argv[10]) / 2 + 2); char *end = hex2bin(buf, argv[10], strlen(argv[10])); |