[PATCH] syslogd should use _PATH_LOG when available

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Aug 7 09:32:44 UTC 2013


On 5 August 2013 02:11:46 Denys Vlasenko <vda.linux at googlemail.com> wrote:
> On Tue, May 8, 2012 at 4:51 PM, Cédric Cabessa <ccabessa at genymobile.com> wrote:
> > ---
> >  sysklogd/syslogd.c |   11 +++++++----
> >  1 files changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
> > index fc380d9..f7fbc16 100644
> > --- a/sysklogd/syslogd.c
> > +++ b/sysklogd/syslogd.c
> > @@ -55,6 +55,9 @@
> >  #define SYSLOG_NAMES_CONST
> >  #include <syslog.h>
> >  */
> > +#ifndef _PATH_LOG
> > +#define _PATH_LOG      "/dev/log"
> > +#endif
> >
> >  #include <sys/un.h>
> >  #include <sys/uio.h>
> > @@ -768,8 +771,8 @@ static NOINLINE int create_socket(void)
> >
> >         /* Unlink old /dev/log or object it points to. */
> >         /* (if it exists, bind will fail) */
> > -       strcpy(sunx.sun_path, "/dev/log");
> > -       dev_log_name = xmalloc_follow_symlinks("/dev/log");
> > +       strcpy(sunx.sun_path, _PATH_LOG);
> > +       dev_log_name = xmalloc_follow_symlinks(_PATH_LOG);
> >         if (dev_log_name) {
> >                 safe_strncpy(sunx.sun_path, dev_log_name, 
> sizeof(sunx.sun_path));
> >                 free(dev_log_name);
> > @@ -778,7 +781,7 @@ static NOINLINE int create_socket(void)
> >
> >         sock_fd = xsocket(AF_UNIX, SOCK_DGRAM, 0);
> >         xbind(sock_fd, (struct sockaddr *) &sunx, sizeof(sunx));
> > -       chmod("/dev/log", 0666);
> > +       chmod(_PATH_LOG, 0666);
> >
> >         return sock_fd;
> >  }
> > @@ -847,7 +850,7 @@ static void do_syslogd(void)
> >                 sz = read(sock_fd, recvbuf, MAX_READ - 1);
> >                 if (sz < 0) {
> >                         if (!bb_got_signal)
> > -                               bb_perror_msg("read from /dev/log");
> > +                               bb_perror_msg("read from %s", _PATH_LOG);
> >                         break;
> >                 }
> >
>
>
> Applied, thanks for reminding me!

Erm. And what about all other occurances?
We already have passwd related path handling proper in libbb.h / platform.h 
only "complication" is PATH_LOG living in syslog.h instead of paths.h

Thanks,


Sent with AquaMail for Android
http://www.aqua-mail.com




More information about the busybox mailing list