diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2005-11-03 20:47:50 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2005-11-03 20:47:50 +0000 |
commit | 15eaca1c3fadd40d41d0f61cb656923be443c577 (patch) | |
tree | fbf4c19ebb71cf021569dbc294e146162dc664d6 /newlib | |
parent | d31a862312eebff8f99e28f30d245248408b538b (diff) | |
download | newlib-15eaca1c3fadd40d41d0f61cb656923be443c577.zip newlib-15eaca1c3fadd40d41d0f61cb656923be443c577.tar.gz newlib-15eaca1c3fadd40d41d0f61cb656923be443c577.tar.bz2 |
2005-11-03 Jeff Johnston <jjohnstn@redhat.com>
* libc/unix/getcwd.c: Don't use non-reentrant syscall names.
* libc/unix/getlogin.c: Ditto.
* libc/unix/getpass.c: Ditto.
* libc/unix/getut.c: Ditto.
* libc/unix/ttyname.c: Ditto.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 8 | ||||
-rw-r--r-- | newlib/libc/unix/getcwd.c | 10 | ||||
-rw-r--r-- | newlib/libc/unix/getlogin.c | 8 | ||||
-rw-r--r-- | newlib/libc/unix/getpass.c | 2 | ||||
-rw-r--r-- | newlib/libc/unix/getut.c | 12 | ||||
-rw-r--r-- | newlib/libc/unix/ttyname.c | 10 |
6 files changed, 29 insertions, 21 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index dd96d27..8b7fda9 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,11 @@ +2005-11-03 Jeff Johnston <jjohnstn@redhat.com> + + * libc/unix/getcwd.c: Don't use non-reentrant syscall names. + * libc/unix/getlogin.c: Ditto. + * libc/unix/getpass.c: Ditto. + * libc/unix/getut.c: Ditto. + * libc/unix/ttyname.c: Ditto. + 2005-11-03 Shaun Jackman <sjackman@gmail.com> * libc/include/sys/unistd.h (readlink, symlink): Provide these diff --git a/newlib/libc/unix/getcwd.c b/newlib/libc/unix/getcwd.c index 826fc78..f57e147 100644 --- a/newlib/libc/unix/getcwd.c +++ b/newlib/libc/unix/getcwd.c @@ -124,7 +124,7 @@ getcwd (pt, size) for (first = 1;; first = 0) { /* Stat the current level. */ - if (_stat (up, &s)) + if (stat (up, &s)) goto err; /* Save current node values. */ @@ -165,7 +165,7 @@ getcwd (pt, size) *bup = '\0'; /* Open and stat parent directory. */ - if (!(dir = _opendir (up)) || _fstat (__dirfd (dir), &s)) + if (!(dir = opendir (up)) || fstat (__dirfd (dir), &s)) goto err; /* Add trailing slash for next directory. */ @@ -182,7 +182,7 @@ getcwd (pt, size) { for (;;) { - if (!(dp = _readdir (dir))) + if (!(dp = readdir (dir))) goto notfound; if (dp->d_ino == ino) break; @@ -191,7 +191,7 @@ getcwd (pt, size) else for (;;) { - if (!(dp = _readdir (dir))) + if (!(dp = readdir (dir))) goto notfound; if (ISDOT (dp)) continue; @@ -238,7 +238,7 @@ getcwd (pt, size) *--bpt = '/'; bpt -= strlen (dp->d_name); bcopy (dp->d_name, bpt, strlen (dp->d_name)); - (void) _closedir (dir); + (void) closedir (dir); /* Truncate any file name. */ *bup = '\0'; diff --git a/newlib/libc/unix/getlogin.c b/newlib/libc/unix/getlogin.c index e043b02..ea4ca29 100644 --- a/newlib/libc/unix/getlogin.c +++ b/newlib/libc/unix/getlogin.c @@ -19,24 +19,24 @@ getlogin () || ((tty = ttyname (2)) == 0)) return 0; - if ((utmp_fd = _open (UTMP_FILE, O_RDONLY)) == -1) + if ((utmp_fd = open (UTMP_FILE, O_RDONLY)) == -1) return 0; if (!strncmp (tty, "/dev/", 5)) tty += 5; - while (_read (utmp_fd, &utmp_buf, sizeof (utmp_buf)) == sizeof (utmp_buf)) + while (read (utmp_fd, &utmp_buf, sizeof (utmp_buf)) == sizeof (utmp_buf)) { if (!strncmp (tty, utmp_buf.ut_line, sizeof (utmp_buf.ut_line)) && utmp_buf.ut_type == USER_PROCESS) { - _close (utmp_fd); + close (utmp_fd); memset (buf, 0, sizeof (buf)); strncpy (buf, utmp_buf.ut_user, sizeof (utmp_buf.ut_user)); return buf; } } - _close (utmp_fd); + close (utmp_fd); return 0; } diff --git a/newlib/libc/unix/getpass.c b/newlib/libc/unix/getpass.c index db0e52d..69327ba 100644 --- a/newlib/libc/unix/getpass.c +++ b/newlib/libc/unix/getpass.c @@ -90,7 +90,7 @@ getpass (prompt) if (p < buf + _PASSWORD_LEN) *p++ = ch; *p = '\0'; - (void) _write (fileno (outfp), "\n", 1); + (void) write (fileno (outfp), "\n", 1); if (echo) { term.c_lflag |= ECHO; diff --git a/newlib/libc/unix/getut.c b/newlib/libc/unix/getut.c index 1e2b755..554ed3c 100644 --- a/newlib/libc/unix/getut.c +++ b/newlib/libc/unix/getut.c @@ -16,15 +16,15 @@ setutent () { if (utmp_fd == -2) { - utmp_fd = _open (utmp_file, O_RDONLY); + utmp_fd = open (utmp_file, O_RDONLY); } - _lseek (utmp_fd, 0, SEEK_SET); + lseek (utmp_fd, 0, SEEK_SET); } void endutent () { - _close (utmp_fd); + close (utmp_fd); utmp_fd = -2; } @@ -39,7 +39,7 @@ getutent () { if (utmp_fd == -2) setutent (); - if (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) < sizeof (utmp_data)) + if (read (utmp_fd, &utmp_data, sizeof (utmp_data)) < sizeof (utmp_data)) return 0; return &utmp_data; } @@ -47,7 +47,7 @@ getutent () struct utmp * getutid (struct utmp *id) { - while (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data)) + while (read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data)) { switch (id->ut_type) { @@ -73,7 +73,7 @@ getutid (struct utmp *id) struct utmp * getutline (struct utmp *line) { - while (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data)) + while (read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data)) { if ((utmp_data.ut_type == LOGIN_PROCESS || utmp_data.ut_type == USER_PROCESS) && diff --git a/newlib/libc/unix/ttyname.c b/newlib/libc/unix/ttyname.c index 558f709..09f12a3 100644 --- a/newlib/libc/unix/ttyname.c +++ b/newlib/libc/unix/ttyname.c @@ -62,13 +62,13 @@ ttyname (fd) return NULL; /* Must be a character device. */ - if (_fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) + if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) return NULL; - if ((dp = _opendir (_PATH_DEV)) == NULL) + if ((dp = opendir (_PATH_DEV)) == NULL) return NULL; - while ((dirp = _readdir (dp)) != NULL) + while ((dirp = readdir (dp)) != NULL) { if (dirp->d_ino != sb.st_ino) continue; @@ -76,9 +76,9 @@ ttyname (fd) if (stat (buf, &dsb) || sb.st_dev != dsb.st_dev || sb.st_ino != dsb.st_ino) continue; - (void) _closedir (dp); + (void) closedir (dp); return buf; } - (void) _closedir (dp); + (void) closedir (dp); return NULL; } |