mailing list of musl libc
 help / color / mirror / code / Atom feed
* paths.h and similar constants, internal usage?
@ 2014-03-29  8:38 u-igbb
  2014-03-29 17:19 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: u-igbb @ 2014-03-29  8:38 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-29 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-29  8:38 paths.h and similar constants, internal usage? u-igbb
2014-03-29 17:19 ` Rich Felker
2014-03-29 17:36   ` u-igbb

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).