[PATCH] syslogd +realpath

Marc Leeman marc.leeman at gmail.com
Wed Feb 7 16:58:34 UTC 2007


On Wed, Feb 07, 2007 at 05:35:07PM +0100, Marc Leeman wrote:
> > The link is replaced with a socket (/ fs is RW).
> 
> Forgot to mention that I am using uclibc on powerpc.:


adding:

char *xmalloc_realpath(const char *path)
{
#if defined(__GLIBC__) && !defined(__UCLIBC__)
    /* glibc provides a non-standard extension */
    return realpath(path, NULL);
#else
    char buf[PATH_MAX+1];

    fprintf(stdout,"realpath returns %s\n",realpath(path,buf));
    fprintf(stdout,"realpath buf is %s\n",buf);
    /* on error returns NULL (xstrdup(NULL) ==NULL) */
    return xstrdup(realpath(path, buf));
#endif
}

results in:

$ /sbin/syslogd -n -m 0 -C16
realpath returns (null)
realpath buf is /tmp/log
syslogd: bind: Address already in use

oeps!

let's blatantly ignore the comment about "on error":

char *xmalloc_realpath(const char *path)
{
#if defined(__GLIBC__) && !defined(__UCLIBC__)
    /* glibc provides a non-standard extension */
    return realpath(path, NULL);
#else
    char buf[PATH_MAX+1];

    fprintf(stdout,"realpath returns %s\n",realpath(path,buf));
    fprintf(stdout,"realpath buf is %s\n",buf);
    /* on error returns NULL (xstrdup(NULL) ==NULL) */
    return xstrdup(buf);
#endif
}

$ ls -al /tmp/log
srw-rw-rw-    1 0        0               0 Jan  1 00:00 /tmp/log

this seems to give us what we expect :)

cf. att'd patch

-- 
  Marc Leeman
  R&D Firmware Engineer
  Security & Monitoring Division
  
  Barco N.V.
  Noordlaan 5, 
  B-8520 Kuurne
  Tel. +32 (0)56 368 428
  Tel. +32 (0)56 368 605
  mailto:marc.leeman at barco.com
  http://www.barco.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmalloc_realpath.diff
Type: text/x-diff
Size: 459 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070207/35980f6c/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070207/35980f6c/attachment-0002.pgp 


More information about the busybox mailing list