aboutsummaryrefslogtreecommitdiffstats
path: root/libc/unistd
diff options
context:
space:
mode:
Diffstat (limited to 'libc/unistd')
-rw-r--r--libc/unistd/exec.c6
-rw-r--r--libc/unistd/open.c2
-rw-r--r--libc/unistd/openat.c2
-rw-r--r--libc/unistd/opendir.c6
-rw-r--r--libc/unistd/sigsetmask.c2
5 files changed, 11 insertions, 7 deletions
diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c
index cbb98b366..89396ac31 100644
--- a/libc/unistd/exec.c
+++ b/libc/unistd/exec.c
@@ -194,9 +194,9 @@ execvp(const char *name, char * const *argv)
(void)writev(STDERR_FILENO, iov, 3);
continue;
}
- bcopy(p, buf, lp);
+ memcpy(buf, p, lp);
buf[lp] = '/';
- bcopy(name, buf + lp + 1, ln);
+ memcpy(buf + lp + 1, name, ln);
buf[lp + ln + 1] = '\0';
retry: (void)execve(bp, argv, environ);
@@ -216,7 +216,7 @@ retry: (void)execve(bp, argv, environ);
goto done;
memp[0] = "sh";
memp[1] = bp;
- bcopy(argv + 1, memp + 2, cnt * sizeof(char *));
+ memcpy(memp + 2, argv + 1, cnt * sizeof(char *));
(void)execve(_PATH_BSHELL, memp, environ);
goto done;
case ENOMEM:
diff --git a/libc/unistd/open.c b/libc/unistd/open.c
index e8b1c8975..03cba4520 100644
--- a/libc/unistd/open.c
+++ b/libc/unistd/open.c
@@ -35,9 +35,7 @@ int open(const char *pathname, int flags, ...)
{
mode_t mode = 0;
-#if !defined(__i386__)
flags |= O_LARGEFILE;
-#endif
if (flags & O_CREAT)
{
diff --git a/libc/unistd/openat.c b/libc/unistd/openat.c
index 88b39a411..6b7b36738 100644
--- a/libc/unistd/openat.c
+++ b/libc/unistd/openat.c
@@ -35,9 +35,7 @@ int openat(int fd, const char *pathname, int flags, ...)
{
mode_t mode = 0;
-#if !defined(__i386__)
flags |= O_LARGEFILE;
-#endif
if (flags & O_CREAT)
{
diff --git a/libc/unistd/opendir.c b/libc/unistd/opendir.c
index afa3ea0ee..3aa96c97a 100644
--- a/libc/unistd/opendir.c
+++ b/libc/unistd/opendir.c
@@ -238,6 +238,7 @@ int scandir(const char *dir, struct dirent ***namelist,
de_list = (struct dirent **)
malloc(sizeof(struct dirent *)*de_list_size);
if (de_list == NULL) {
+ closedir(d);
return -1;
}
}
@@ -248,7 +249,12 @@ int scandir(const char *dir, struct dirent ***namelist,
de_list_new = (struct dirent **)
realloc(de_list, sizeof(struct dirent *)*de_list_size);
if (de_list_new == NULL) {
+ int i = 0;
+ for (;i < n_elem; i++) {
+ free(de_list[i]);
+ }
free(de_list);
+ closedir(d);
return -1;
}
de_list = de_list_new;
diff --git a/libc/unistd/sigsetmask.c b/libc/unistd/sigsetmask.c
index b98759577..4f4645865 100644
--- a/libc/unistd/sigsetmask.c
+++ b/libc/unistd/sigsetmask.c
@@ -38,6 +38,8 @@ sigsetmask(int mask)
sigset_t the_sigset;
} in, out;
+ in.the_mask = mask;
+
n = sigprocmask(SIG_SETMASK, &in.the_sigset, &out.the_sigset);
if (n)
return n;