Re: [PATCH] task name handling in proc fs

From: Paul Jackson
Date: Wed Jul 07 2004 - 21:33:30 EST


+void set_task_comm(struct task_struct *tsk, char *buf)
+{ ...
+ for(i=0; i<sizeof(tsk->comm); i++) {
+ tsk->comm[i] = *buf++;
+ if (!tsk->comm[i])
+ break;
+ }
+ tsk->comm[sizeof(tsk->comm)-1] = '\0'; /* just in case */

That code fragment looks to me like:

strlcpy (tsk->comm, buf, sizeof(tsk->comm));

Unless I'm missing something, I'd prefer 'strlcpy'.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/