lkml.org 
[lkml]   [2022]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] exec: Force binary name when argv is empty
On Tue, Sep 20, 2022 at 08:08:12PM +0800, Ren Zhijie wrote:
> From: Hui Tang <tanghui20@huawei.com>
>
> First run './execv-main execv-child', there is empty in 'COMMAND' column
> when run 'ps -u'.
>
> USER PID %CPU %MEM VSZ RSS TTY [...] TIME COMMAND
> root 368 0.3 0.0 4388 764 ttyS0 0:00 ./execv-main
> root 369 0.6 0.0 4520 812 ttyS0 0:00
>
> The program 'execv-main' as follows:
>
> int main(int argc, char **argv)
> {
> char *execv_argv[] = {NULL};
> pid_t pid = fork();
>
> if (pid == 0) {
> execv(argv[1], execv_argv);
> } else if (pid > 0) {
> wait(NULL);
> }
> return 0;
> }
>
> So replace empty string ("") added with the name of binary
> when calling execve with a NULL argv.
>
> Fixes: dcd46d897adb ("exec: Force single empty string when argv is empty")

I don't see the point, to be honest... You've passed BS argv to execve(),
why would you expect anything pretty from ps(1)?

IOW, where's the bug you are fixing?

\
 
 \ /
  Last update: 2022-09-20 22:54    [W:0.049 / U:1.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site