aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/exec.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/exec.c b/fs/exec.c
index bff43aeb235e..5e559013e303 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1379,17 +1379,14 @@ EXPORT_SYMBOL(set_binfmt);
1379 * name into corename, which must have space for at least 1379 * name into corename, which must have space for at least
1380 * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. 1380 * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
1381 */ 1381 */
1382static int format_corename(char *corename, const char *pattern, long signr) 1382static int format_corename(char *corename, int nr_threads, long signr)
1383{ 1383{
1384 const char *pat_ptr = pattern; 1384 const char *pat_ptr = core_pattern;
1385 int ispipe = (*pat_ptr == '|');
1385 char *out_ptr = corename; 1386 char *out_ptr = corename;
1386 char *const out_end = corename + CORENAME_MAX_SIZE; 1387 char *const out_end = corename + CORENAME_MAX_SIZE;
1387 int rc; 1388 int rc;
1388 int pid_in_pattern = 0; 1389 int pid_in_pattern = 0;
1389 int ispipe = 0;
1390
1391 if (*pattern == '|')
1392 ispipe = 1;
1393 1390
1394 /* Repeat as long as we have more pattern to process and more output 1391 /* Repeat as long as we have more pattern to process and more output
1395 space */ 1392 space */
@@ -1490,7 +1487,7 @@ static int format_corename(char *corename, const char *pattern, long signr)
1490 * and core_uses_pid is set, then .%pid will be appended to 1487 * and core_uses_pid is set, then .%pid will be appended to
1491 * the filename. Do not do this for piped commands. */ 1488 * the filename. Do not do this for piped commands. */
1492 if (!ispipe && !pid_in_pattern 1489 if (!ispipe && !pid_in_pattern
1493 && (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)) { 1490 && (core_uses_pid || nr_threads)) {
1494 rc = snprintf(out_ptr, out_end - out_ptr, 1491 rc = snprintf(out_ptr, out_end - out_ptr,
1495 ".%d", task_tgid_vnr(current)); 1492 ".%d", task_tgid_vnr(current));
1496 if (rc > out_end - out_ptr) 1493 if (rc > out_end - out_ptr)
@@ -1753,7 +1750,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1753 * uses lock_kernel() 1750 * uses lock_kernel()
1754 */ 1751 */
1755 lock_kernel(); 1752 lock_kernel();
1756 ispipe = format_corename(corename, core_pattern, signr); 1753 ispipe = format_corename(corename, retval, signr);
1757 unlock_kernel(); 1754 unlock_kernel();
1758 /* 1755 /*
1759 * Don't bother to check the RLIMIT_CORE value if core_pattern points 1756 * Don't bother to check the RLIMIT_CORE value if core_pattern points