aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coredump.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/coredump.c')
-rw-r--r--fs/coredump.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/coredump.c b/fs/coredump.c
index 56a9ab963a40..72f816d6cad9 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -165,13 +165,15 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm)
165 cn->corename = NULL; 165 cn->corename = NULL;
166 if (expand_corename(cn, core_name_size)) 166 if (expand_corename(cn, core_name_size))
167 return -ENOMEM; 167 return -ENOMEM;
168 cn->corename[0] = '\0';
169
170 if (ispipe)
171 ++pat_ptr;
168 172
169 /* Repeat as long as we have more pattern to process and more output 173 /* Repeat as long as we have more pattern to process and more output
170 space */ 174 space */
171 while (*pat_ptr) { 175 while (*pat_ptr) {
172 if (*pat_ptr != '%') { 176 if (*pat_ptr != '%') {
173 if (*pat_ptr == 0)
174 goto out;
175 err = cn_printf(cn, "%c", *pat_ptr++); 177 err = cn_printf(cn, "%c", *pat_ptr++);
176 } else { 178 } else {
177 switch (*++pat_ptr) { 179 switch (*++pat_ptr) {
@@ -240,6 +242,7 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm)
240 return err; 242 return err;
241 } 243 }
242 244
245out:
243 /* Backward compatibility with core_uses_pid: 246 /* Backward compatibility with core_uses_pid:
244 * 247 *
245 * If core_pattern does not include a %p (as is the default) 248 * If core_pattern does not include a %p (as is the default)
@@ -250,7 +253,6 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm)
250 if (err) 253 if (err)
251 return err; 254 return err;
252 } 255 }
253out:
254 return ispipe; 256 return ispipe;
255} 257}
256 258
@@ -580,7 +582,7 @@ void do_coredump(siginfo_t *siginfo)
580 goto fail_dropcount; 582 goto fail_dropcount;
581 } 583 }
582 584
583 helper_argv = argv_split(GFP_KERNEL, cn.corename+1, NULL); 585 helper_argv = argv_split(GFP_KERNEL, cn.corename, NULL);
584 if (!helper_argv) { 586 if (!helper_argv) {
585 printk(KERN_WARNING "%s failed to allocate memory\n", 587 printk(KERN_WARNING "%s failed to allocate memory\n",
586 __func__); 588 __func__);
@@ -597,7 +599,7 @@ void do_coredump(siginfo_t *siginfo)
597 599
598 argv_free(helper_argv); 600 argv_free(helper_argv);
599 if (retval) { 601 if (retval) {
600 printk(KERN_INFO "Core dump to %s pipe failed\n", 602 printk(KERN_INFO "Core dump to |%s pipe failed\n",
601 cn.corename); 603 cn.corename);
602 goto close_fail; 604 goto close_fail;
603 } 605 }