Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140329083856.GI8221@example.net>
Date: Sat, 29 Mar 2014 08:38:57 +0000
From: u-igbb@...ey.se
To: musl@...ts.openwall.com
Subject: paths.h and similar constants, internal usage?

Hello,

I noticed that musl defines certain constants but does not use them
even when it could. I find if better in the long run to have
a single definition of a string instead of multiple ones, for
various reasons.

Would it be suitable for upstream to make use of the available symbolic
constants in the following cases where explicit strings are being used
instead:

-----------------------------------------------------------------------------
./include/paths.h:#define       _PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin"
./src/process/execvp.c: if (!path) path = "/usr/local/bin:/bin:/usr/bin";
-----------------------------------------------------------------------------
./include/paths.h:#define       _PATH_BSHELL    "/bin/sh"
./src/process/system.c: ret = posix_spawn(&pid, "/bin/sh", 0, &attr,
./src/stdio/popen.c:                    if (!(e = posix_spawn(&pid, "/bin/sh", &fa, 0,
./src/misc/wordexp.c:           execl("/bin/sh", "sh", "-c",
-----------------------------------------------------------------------
./include/paths.h:#define       _PATH_DEVNULL   "/dev/null"
./src/legacy/daemon.c:          if ((fd = open("/dev/null", O_RDWR)) < 0) return -1;
./src/env/__init_security.c:            if (__syscall(SYS_open, "/dev/null", O_RDWR|O_LARGEFILE)<0)
-----------------------------------------------------------------------
./include/syslog.h:#define _PATH_LOG "/dev/log"
./src/misc/syslog.c:    "/dev/log"
-----------------------------------------------------------------------
./include/resolv.h:#define _PATH_RESCONF        "/etc/resolv.conf"
./src/network/__dns.c:  f = __fopen_rb_ca("/etc/resolv.conf", &_f, _buf, sizeof _buf);
./src/network/getaddrinfo.c:    f = __fopen_rb_ca("/etc/resolv.conf", &_f, _buf, sizeof _buf);
-----------------------------------------------------------------------
./include/paths.h:#define       _PATH_SHADOW    "/etc/shadow"
./include/shadow.h:#define      SHADOW "/etc/shadow"
./src/passwd/getspnam_r.c:              f = fopen("/etc/shadow", "rbe");
-----------------------------------------------------------------------
./include/paths.h:#define       _PATH_SHELLS    "/etc/shells"
./src/legacy/getusershell.c:    if (!f) f = fopen("/etc/shells", "rbe");
-----------------------------------------------------------------------
./include/paths.h:#define       _PATH_TTY       "/dev/tty"
./src/legacy/getpass.c: if ((fd = open("/dev/tty", O_RDONLY|O_NOCTTY)) < 0) fd = 0;
./src/unistd/ctermid.c: fd = open("/dev/tty", O_WRONLY | O_NOCTTY | O_CLOEXEC);
-----------------------------------------------------------------------

If yes, then I can try to prepare a patch.

Regards,
Rune

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.