From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4740 Path: news.gmane.org!not-for-mail From: u-igbb@aetey.se Newsgroups: gmane.linux.lib.musl.general Subject: paths.h and similar constants, internal usage? Date: Sat, 29 Mar 2014 08:38:57 +0000 Message-ID: <20140329083856.GI8221@example.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1396082363 9521 80.91.229.3 (29 Mar 2014 08:39:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Mar 2014 08:39:23 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4744-gllmg-musl=m.gmane.org@lists.openwall.com Sat Mar 29 09:39:30 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WTonY-0005tf-46 for gllmg-musl@plane.gmane.org; Sat, 29 Mar 2014 09:39:28 +0100 Original-Received: (qmail 23897 invoked by uid 550); 29 Mar 2014 08:39:25 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 23888 invoked from network); 29 Mar 2014 08:39:25 -0000 X-T2-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50 Received-SPF: none receiver=mailfe05.swip.net; client-ip=192.99.8.96; envelope-from=u-igbb@aetey.se Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:4740 Archived-At: 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