[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] Fix /proc/*/cmdline.
From: |
olafBuddenhagen |
Subject: |
Re: [PATCH 1/2] Fix /proc/*/cmdline. |
Date: |
Fri, 13 Aug 2010 17:13:20 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi,
On Fri, Aug 13, 2010 at 06:06:41AM +0200, Jeremie Koenig wrote:
> On Linux, the per-process cmdline files should include the whole command line,
> with subsequent arguments separated by NUL bytes. However, for some reason we
> used to truncate it after the first one and append " \n".
Hm... As far as I can see, you actually fixed two bugs here: the
completely wrong handling of the actual data; and wrong/missing error
handling. I'm not sure if it's worth splitting into separate patches --
but it should be reflected in the commit message...
> err = set_field_value (ps, PSTAT_ARGS);
> + if (err)
> + goto out;
>
> - if (! err)
> - if (asprintf (&cmdline_data, "%s \n", ps->args) == -1)
> - return errno;
> -
> - memcpy (data, cmdline_data, strlen(cmdline_data));
> - *len = strlen (data);
> + memcpy (data, ps->args, ps->args_len);
> + *len = ps->args_len;
>
> +out:
> _proc_stat_free (ps);
> - free (cmdline_data);
> return err;
> }
Actually, using an "if (!err)" block (i.e. like the original code, minus
bugs) would be much nicer here IMHO...
-antrik-
- [PATCH 1/2] Fix /proc/*/cmdline., Jeremie Koenig, 2010/08/13
- [PATCH 2/2] Implement some (global) symlinks., Jeremie Koenig, 2010/08/13
- Re: [PATCH 1/2] Fix /proc/*/cmdline.,
olafBuddenhagen <=
- [PATCH 2/4] update_pid_entries(): fix awkwardly indented uninitialized memory leak, Jeremie Koenig, 2010/08/13
- [PATCH 3/4] Set an appropriate st_mode on symlinks., Jeremie Koenig, 2010/08/13
- Re: [PATCH 3/4] Set an appropriate st_mode on symlinks., olafBuddenhagen, 2010/08/15
- Re: [PATCH 3/4] Set an appropriate st_mode on symlinks., Jeremie Koenig, 2010/08/15
- [PATCH 4/4] Implement /proc/cmdline and /proc/mounts as symlinks., Jeremie Koenig, 2010/08/13
- Re: [PATCH 4/4] Implement /proc/cmdline and /proc/mounts as symlinks., olafBuddenhagen, 2010/08/15