lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <200711082131.lA8LVgkb015134@imap1.linux-foundation.org>
Date:	Thu, 08 Nov 2007 13:31:42 -0800
From:	akpm@...ux-foundation.org
To:	linux-kernel@...r.kernel.org
Cc:	akpm@...ux-foundation.org, drepper@...hat.com, mingo@...e.hu,
	roland@...hat.com
Subject: [patch 1/2] get_task_comm(): return the result

From: Andrew Morton <akpm@...ux-foundation.org>

It was dumb to make get_task_comm() return void.  Change it to return a
pointer to the resulting output for caller convenience.

Cc: Ulrich Drepper <drepper@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Roland McGrath <roland@...hat.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---

 fs/exec.c             |    3 ++-
 include/linux/sched.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff -puN include/linux/sched.h~get_task_comm-return-the-result include/linux/sched.h
--- a/include/linux/sched.h~get_task_comm-return-the-result
+++ a/include/linux/sched.h
@@ -1692,7 +1692,7 @@ extern long do_fork(unsigned long, unsig
 struct task_struct *fork_idle(int);
 
 extern void set_task_comm(struct task_struct *tsk, char *from);
-extern void get_task_comm(char *to, struct task_struct *tsk);
+extern char *get_task_comm(char *to, struct task_struct *tsk);
 
 #ifdef CONFIG_SMP
 extern void wait_task_inactive(struct task_struct * p);
diff -puN fs/exec.c~get_task_comm-return-the-result fs/exec.c
--- a/fs/exec.c~get_task_comm-return-the-result
+++ a/fs/exec.c
@@ -947,12 +947,13 @@ static void flush_old_files(struct files
 	spin_unlock(&files->file_lock);
 }
 
-void get_task_comm(char *buf, struct task_struct *tsk)
+char *get_task_comm(char *buf, struct task_struct *tsk)
 {
 	/* buf must be at least sizeof(tsk->comm) in size */
 	task_lock(tsk);
 	strncpy(buf, tsk->comm, sizeof(tsk->comm));
 	task_unlock(tsk);
+	return buf;
 }
 
 void set_task_comm(struct task_struct *tsk, char *buf)
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ