> -----Original Message-----
> From: Denys Vlasenko [mailto:[EMAIL PROTECTED]
> Sent: den 19 april 2008 21:06
> To: Joakim Tjernlund
> Cc: [email protected]
> Subject: Re: [PATCH] start-stop-daemon: make --exec follow symlinks.
>
> On Saturday 19 April 2008 12:15, Joakim Tjernlund wrote:
> > > -----Original Message-----
> > > From: Denys Vlasenko [mailto:[EMAIL PROTECTED]
> > > Sent: den 19 april 2008 04:45
> > > To: [email protected]; [EMAIL PROTECTED]
> > > Subject: Re: [PATCH] start-stop-daemon: make --exec follow symlinks.
> > >
> > >
> > > > static int pid_is_exec(pid_t pid, const char *name)
> > > > {
> > > > char buf[sizeof("/proc//exe") + sizeof(int)*3];
> > > > - char *execbuf;
> > > > - int n;
> > > > + struct stat st;
> > > >
> > > > sprintf(buf, "/proc/%u/exe", pid);
> > > > - n = strlen(name) + 1;
> > > > - execbuf = xzalloc(n + 1);
> > > > - readlink(buf, execbuf, n);
> > > > -
> > > > - /* if readlink fails, execbuf still contains "" */
> > > > - n = strcmp(execbuf, name);
> > > > - if (ENABLE_FEATURE_CLEAN_UP)
> > > > - free(execbuf);
> > > > - return !n; /* nonzero (true) if execbuf == name */
> > > > + if (stat(buf, &st) <0)
> > > > + return 0;
> > > > + if (st.st_dev == execstat.st_dev &&
> > > > + st.st_ino == execstat.st_ino)
> > > > + return 1;
> > > > + return 0;
> > > > }
> > >
> > > "name" is unused now. Don't introduce new warnings.
> >
> > yes, small mistake. I can fix that and commit it if you don't mind?
>
> I applied the patch, see attached. Thanks!
Don't attach, makes it to comment.
reviewed your patch and found:
if (execname)
xstat(execname, &execstat);
xstat is an improvement compared to my patches I sent a few hours ago.
I can fix that, because I rather commit the series I sent that just this single
one.
I got a cleanup patch queued up after that which will remove the
second argument to pid_is_exec(), pid_is_user() and pid_is_cmd()
Jocke
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox