summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-05 23:35:09 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-05 23:35:09 +0200
commita76558a92e21643a628c3c6a8cd22816634b1749 (patch)
tree8b1d7274fa71bcb36750dc671240224835225707
parent45f5c6f25b11fddd66f7a486b988d0d8e7e00341 (diff)
downloaduClibc-alpine-a76558a92e21643a628c3c6a8cd22816634b1749.tar.bz2
uClibc-alpine-a76558a92e21643a628c3c6a8cd22816634b1749.tar.xz
do not pass 3rd param to open() which do not create files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libc/unistd/daemon.c16
-rw-r--r--utils/ldd.c2
2 files changed, 5 insertions, 13 deletions
diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c
index b18d6188f..3dcd995d2 100644
--- a/libc/unistd/daemon.c
+++ b/libc/unistd/daemon.c
@@ -49,14 +49,6 @@
#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
-/* libc_hidden_proto(open) */
-/* libc_hidden_proto(close) */
-/* libc_hidden_proto(_exit) */
-/* libc_hidden_proto(dup2) */
-/* libc_hidden_proto(setsid) */
-/* libc_hidden_proto(chdir) */
-/* libc_hidden_proto(fork) */
-
#ifndef __ARCH_USE_MMU__
#include <sys/syscall.h>
#include <sched.h>
@@ -93,7 +85,7 @@ static inline pid_t fork_parent(void)
}
#endif
-int daemon( int nochdir, int noclose )
+int daemon(int nochdir, int noclose)
{
int fd;
@@ -101,18 +93,18 @@ int daemon( int nochdir, int noclose )
return -1;
if (setsid() == -1)
- return(-1);
+ return -1;
if (!nochdir)
chdir("/");
- if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR)) != -1) {
dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
if (fd > 2)
close(fd);
}
- return(0);
+ return 0;
}
#endif
diff --git a/utils/ldd.c b/utils/ldd.c
index e7a94cbc4..9cfd984fa 100644
--- a/utils/ldd.c
+++ b/utils/ldd.c
@@ -262,7 +262,7 @@ static int map_cache(void)
else if (cache_addr != NULL)
return 0;
- if (stat(LDSO_CACHE, &st) || (fd = open(LDSO_CACHE, O_RDONLY, 0)) < 0) {
+ if (stat(LDSO_CACHE, &st) || (fd = open(LDSO_CACHE, O_RDONLY)) < 0) {
fprintf(stderr, "ldd: can't open cache '%s'\n", LDSO_CACHE);
cache_addr = (caddr_t) - 1; /* so we won't try again */
return -1;