Re: [RFC] Some useless cleanup

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Thu May 09 2002 - 07:36:50 EST


On Thu, 9 May 2002 14:28:41 +0400
Paul P Komkoff Jr <i@stingr.net> wrote:

> Look at this very funny cleanup changeset for 2.4
> avaliable at linux-stingr.bkbits.net/comm

Um, why not simply:

static inline void set_name(struct task_struct *tsk, const char *name)
{
        /* comm is always nul-terminated already */
        strncpy(tsk->comm, name, sizeof(tsk->comm)-1);
}

Your implementation using snprintf is (wasteful and) dangerous,
Rusty.

-- 
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 14 2002 - 12:00:12 EST