From 15eaca1c3fadd40d41d0f61cb656923be443c577 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 3 Nov 2005 20:47:50 +0000 Subject: 2005-11-03 Jeff Johnston * 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. --- newlib/ChangeLog | 8 ++++++++ newlib/libc/unix/getcwd.c | 10 +++++----- newlib/libc/unix/getlogin.c | 8 ++++---- newlib/libc/unix/getpass.c | 2 +- newlib/libc/unix/getut.c | 12 ++++++------ newlib/libc/unix/ttyname.c | 10 +++++----- 6 files changed, 29 insertions(+), 21 deletions(-) (limited to 'newlib') diff --git a/newlib/ChangeLog b/newlib/ChangeLog index dd96d27ee..8b7fda9ff 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,11 @@ +2005-11-03 Jeff Johnston + + * 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 * libc/include/sys/unistd.h (readlink, symlink): Provide these diff --git a/newlib/libc/unix/getcwd.c b/newlib/libc/unix/getcwd.c index 826fc789d..f57e14742 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 e043b029f..ea4ca2983 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 db0e52d61..69327ba05 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 1e2b75596..554ed3ca1 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 558f70939..09f12a337 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; } -- cgit v1.2.3