summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/wordexp.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-01-07 06:07:56 +0000
committertjr <tjr@FreeBSD.org>2003-01-07 06:07:56 +0000
commita1a372be062a31bd03532d13658cd116d437ea96 (patch)
tree701eb94248f824486151eea522f5248e271726b9 /lib/libc/gen/wordexp.c
parent34f8e1bd7365a7fd1afa7d073d54d48aa7f24b7e (diff)
downloadFreeBSD-src-a1a372be062a31bd03532d13658cd116d437ea96.zip
FreeBSD-src-a1a372be062a31bd03532d13658cd116d437ea96.tar.gz
Use hidden names (_close, _dup2, _waitpid, etc.) where appropriate.
Diffstat (limited to 'lib/libc/gen/wordexp.c')
-rw-r--r--lib/libc/gen/wordexp.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/libc/gen/wordexp.c b/lib/libc/gen/wordexp.c
index 401a241..9bdb121 100644
--- a/lib/libc/gen/wordexp.c
+++ b/lib/libc/gen/wordexp.c
@@ -102,8 +102,8 @@ we_askshell(const char *words, wordexp_t *we, int flags)
if (pipe(pdes) < 0)
return (WRDE_NOSPACE); /* XXX */
if ((pid = fork()) < 0) {
- close(pdes[0]);
- close(pdes[1]);
+ _close(pdes[0]);
+ _close(pdes[1]);
return (WRDE_NOSPACE); /* XXX */
}
else if (pid == 0) {
@@ -114,18 +114,18 @@ we_askshell(const char *words, wordexp_t *we, int flags)
int devnull;
char *cmd;
- close(pdes[0]);
- if (dup2(pdes[1], STDOUT_FILENO) < 0)
+ _close(pdes[0]);
+ if (_dup2(pdes[1], STDOUT_FILENO) < 0)
_exit(1);
- close(pdes[1]);
+ _close(pdes[1]);
if (asprintf(&cmd, "wordexp%c%s\n", *ifs, words) < 0)
_exit(1);
if ((flags & WRDE_SHOWERR) == 0) {
- if ((devnull = open(_PATH_DEVNULL, O_RDWR, 0666)) < 0)
+ if ((devnull = _open(_PATH_DEVNULL, O_RDWR, 0666)) < 0)
_exit(1);
- if (dup2(devnull, STDERR_FILENO) < 0)
+ if (_dup2(devnull, STDERR_FILENO) < 0)
_exit(1);
- close(devnull);
+ _close(devnull);
}
execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u",
"-c", cmd, NULL);
@@ -138,10 +138,10 @@ we_askshell(const char *words, wordexp_t *we, int flags)
* byte count (not including terminating null bytes), followed by
* the expanded words separated by nulls.
*/
- close(pdes[1]);
- if (read(pdes[0], wbuf, 8) != 8 || read(pdes[0], bbuf, 8) != 8) {
- close(pdes[0]);
- waitpid(pid, &status, 0);
+ _close(pdes[1]);
+ if (_read(pdes[0], wbuf, 8) != 8 || _read(pdes[0], bbuf, 8) != 8) {
+ _close(pdes[0]);
+ _waitpid(pid, &status, 0);
return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX);
}
wbuf[8] = bbuf[8] = '\0';
@@ -162,14 +162,14 @@ we_askshell(const char *words, wordexp_t *we, int flags)
if ((nwv = realloc(we->we_wordv, (we->we_wordc + 1 +
(flags & WRDE_DOOFS ? we->we_offs : 0)) *
sizeof(char *))) == NULL) {
- close(pdes[0]);
- waitpid(pid, &status, 0);
+ _close(pdes[0]);
+ _waitpid(pid, &status, 0);
return (WRDE_NOSPACE);
}
we->we_wordv = nwv;
if ((nstrings = realloc(we->we_strings, we->we_nbytes)) == NULL) {
- close(pdes[0]);
- waitpid(pid, &status, 0);
+ _close(pdes[0]);
+ _waitpid(pid, &status, 0);
return (WRDE_NOSPACE);
}
for (i = 0; i < vofs; i++)
@@ -177,18 +177,18 @@ we_askshell(const char *words, wordexp_t *we, int flags)
we->we_wordv[i] += nstrings - we->we_strings;
we->we_strings = nstrings;
- if (read(pdes[0], we->we_strings + sofs, nbytes) != nbytes) {
- close(pdes[0]);
- waitpid(pid, &status, 0);
+ if (_read(pdes[0], we->we_strings + sofs, nbytes) != nbytes) {
+ _close(pdes[0]);
+ _waitpid(pid, &status, 0);
return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX);
}
- if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) ||
+ if (_waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) ||
WEXITSTATUS(status) != 0) {
- close(pdes[0]);
+ _close(pdes[0]);
return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX);
}
- close(pdes[0]);
+ _close(pdes[0]);
/*
* Break the null-terminated expanded word strings out into
OpenPOWER on IntegriCloud