Skip to contentSkip to conversation

TRIVIAL 2.5.8: clean up fs_exec.c

PATCH In review Rusty Russell 2 participants 2 messages Apr 22, 2002 – Apr 23, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 TRIVIAL 2.5.8: clean up fs_exec.c

Martin Pool <[email protected]>: trivial kernel patch -- clean up fs_exec.c:

(Included in 2.4)

fs/exec.c renamed from fs/exec.c.orig +1 -2
@@ -978,8 +978,7 @@
 	if (current->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
 		goto fail;
 
-	memcpy(corename,"core.", 5);
-	corename[4] = '\0';
+	memcpy(corename,"core", 5); /* include trailing \0 */
  	if (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)
  		sprintf(&corename[4], ".%d", current->pid);
 	file = filp_open(corename, O_CREAT | 2 | O_NOFOLLOW, 0600);

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#1 lore raw

fs/exec.c line 981

Quoted 3 lines · Rusty Russell
fs/exec.c renamed from fs/exec.c.orig +1 -2
-	memcpy(corename,"core.", 5);
-	corename[4] = '\0';
+	memcpy(corename,"core", 5); /* include trailing \0 */

What's wrong with strcpy? gcc3 will even turn it into a memcpy for you. :)

Paul.