__stat: should it end up as UND in libc.so or not?
Franz Sirl
Franz.Sirl-kernel@lauterbach.com
Sun Dec 13 13:08:00 GMT 1998
Am Fri, 11 Dec 1998 schrieb Ulrich Drepper:
>Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:
>
>> Hmm, one candidate was dirent/opendir.os (sysdeps/unix/opendir.c) AFAI
>> remember. This one includes <sys/stat.h> and uses __stat. It should use
>> __xstat here?
>
>Not necessarily. If there is a macro __xstat...
>
>> These are actually quite easy to find, compile glibc with -O0
>> and then use find -name "*.os"|xargs objdump|less
>
>I'll see whether I can recompile everything without optimization.
Ok, as promised a patch to eradicate all the uses of __stat in glibc that break
building without optimization. The resulting libc.so no longer contains UND
__stat. Keep in mind that this might not be true for other platforms, cause
this only covers the files that are compiled on Linux/PPC. grep found a few
other candidates in the sysdeps subdirs, but I don't want to change anything
there, as I can't test it.
Franz.
diff -upr glibc-2.0.106-org/sysdeps/posix/tempname.c glibc-2.0.106/sysdeps/posix/tempname.c
--- glibc-2.0.106-org/sysdeps/posix/tempname.c Sat Aug 8 20:50:08 1998
+++ glibc-2.0.106/sysdeps/posix/tempname.c Sun Dec 13 10:28:02 1998
@@ -33,7 +33,7 @@ static int
direxists (const char *dir)
{
struct stat buf;
- return __stat (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
+ return __xstat (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
}
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
@@ -161,7 +161,7 @@ __gen_tempname (char *tmpl, int openit,
else
{
struct stat st;
- if (__stat (tmpl, &st) < 0)
+ if (__xstat (_STAT_VER, tmpl, &st) < 0)
{
if (errno == ENOENT)
{
Only in glibc-2.0.106/sysdeps/posix: tempname.c~
diff -upr glibc-2.0.106-org/sysdeps/unix/grantpt.c glibc-2.0.106/sysdeps/unix/grantpt.c
--- glibc-2.0.106-org/sysdeps/unix/grantpt.c Fri Sep 18 22:01:48 1998
+++ glibc-2.0.106/sysdeps/unix/grantpt.c Sun Dec 13 11:25:44 1998
@@ -109,7 +109,7 @@ grantpt (int fd)
if (pts_name (fd, &buf, sizeof (_buf)))
return -1;
- if (__stat (buf, &st) < 0)
+ if (__xstat (_STAT_VER, buf, &st) < 0)
goto cleanup;
/* Make sure that we own the device. */
Only in glibc-2.0.106/sysdeps/unix: grantpt.c~
diff -upr glibc-2.0.106-org/sysdeps/unix/opendir.c glibc-2.0.106/sysdeps/unix/opendir.c
--- glibc-2.0.106-org/sysdeps/unix/opendir.c Mon Nov 16 19:22:18 1998
+++ glibc-2.0.106/sysdeps/unix/opendir.c Sun Dec 13 11:23:51 1998
@@ -96,7 +96,7 @@ __opendir (const char *name)
/* We first have to check whether the name is for a directory. We
cannot do this after the open() call since the open/close operation
performed on, say, a tape device might have undesirable effects. */
- if (__stat (name, &statbuf) < 0)
+ if (__xstat (_STAT_VER, name, &statbuf) < 0)
return NULL;
if (! S_ISDIR (statbuf.st_mode))
{
Only in glibc-2.0.106/sysdeps/unix: opendir.c~
diff -upr glibc-2.0.106-org/sysdeps/unix/sysv/linux/ptsname.c glibc-2.0.106/sysdeps/unix/sysv/linux/ptsname.c
--- glibc-2.0.106-org/sysdeps/unix/sysv/linux/ptsname.c Mon Sep 21 16:31:19 1998
+++ glibc-2.0.106/sysdeps/unix/sysv/linux/ptsname.c Sun Dec 13 11:32:35 1998
@@ -123,7 +123,7 @@ __ptsname_r (int fd, char *buf, size_t b
p[2] = '\0';
}
- if (__stat (buf, &st) < 0)
+ if (__xstat (_STAT_VER, buf, &st) < 0)
return errno;
__set_errno (save_errno);
Only in glibc-2.0.106/sysdeps/unix/sysv/linux: ptsname.c~
diff -upr glibc-2.0.106-org/sysvipc/ftok.c glibc-2.0.106/sysvipc/ftok.c
--- glibc-2.0.106-org/sysvipc/ftok.c Thu Nov 7 01:34:39 1996
+++ glibc-2.0.106/sysvipc/ftok.c Sun Dec 13 11:23:03 1998
@@ -28,7 +28,7 @@ ftok (pathname, proj_id)
struct stat st;
key_t key;
- if (__stat (pathname, &st) < 0)
+ if (__xstat (_STAT_VER, pathname, &st) < 0)
return (key_t) -1;
key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)
Only in glibc-2.0.106/sysvipc: ftok.c~
More information about the Libc-alpha
mailing list