mailing list of musl libc
 help / color / mirror / code / Atom feed
From: u-igbb@aetey.se
To: musl@lists.openwall.com
Subject: paths.h and similar constants, internal usage?
Date: Sat, 29 Mar 2014 08:38:57 +0000	[thread overview]
Message-ID: <20140329083856.GI8221@example.net> (raw)

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



             reply	other threads:[~2014-03-29  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-29  8:38 u-igbb [this message]
2014-03-29 17:19 ` Rich Felker
2014-03-29 17:36   ` u-igbb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140329083856.GI8221@example.net \
    --to=u-igbb@aetey.se \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).