summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-05-03 14:09:24 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2008-05-03 14:09:24 +0800
commit9de39b568d5e613de0874681d65caa4c13257080 (patch)
tree42d988b5355bbe98cebf0ecd88d1235f7dad2dcc
parent[CD] Restored non-glibc getcwd support (diff)
downloaddash-9de39b568d5e613de0874681d65caa4c13257080.tar.gz
dash-9de39b568d5e613de0874681d65caa4c13257080.zip
[EXEC] Fixed _PATH_BSHELL warning
With klcc we get

klcc -DHAVE_CONFIG_H -I. -I..  -include ../config.h -DBSD=1 -DSHELL
-DIFS_BROKEN  -Wall -D__CTYPE_NO_INLINE -MT exec.o -MD -MP -MF
.deps/exec.Tpo -c -o exec.o exec.c
exec.c: In function 'tryexec':
exec.c:160: warning: comparison with string literal results in unspecified behavior

Storing it in a local variable fixes the problem.

Thanks to Dan McGee for reporting this.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--ChangeLog4
-rw-r--r--src/exec.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5216521..1126b04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-05-03  Herbert Xu <herbert@gondor.apana.org.au>
+
+	* Fixed _PATH_BSHELL warning.
+
 2008-05-02  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Restored non-glibc getcwd support.
diff --git a/src/exec.c b/src/exec.c
index bbb70e8..42299ea 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -149,6 +149,8 @@ shellexec(char **argv, const char *path, int idx)
 STATIC void
 tryexec(char *cmd, char **argv, char **envp)
 {
+	char *const path_bshell = _PATH_BSHELL;
+
 repeat:
 #ifdef SYSV
 	do {
@@ -157,9 +159,9 @@ repeat:
 #else
 	execve(cmd, argv, envp);
 #endif
-	if (cmd != _PATH_BSHELL && errno == ENOEXEC) {
+	if (cmd != path_bshell && errno == ENOEXEC) {
 		*argv-- = cmd;
-		*argv = cmd = _PATH_BSHELL;
+		*argv = cmd = path_bshell;
 		goto repeat;
 	}
 }