+1999-03-08 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Undo last change.
+ /dev/pts status may change during runtime.
+
+1999-03-08 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r): Undo last
+ change. /dev/pts status can change during runtime.
+
+1999-03-07 Thorsten Kukuk <kukuk@suse.de>
+
+ * sunrpc/svc_tcp.c (readtcp): go into fatal error state if
+ poll reports error.
+ * nis/nss_nisplus/nisplus-parser.c: Avoid duplicate strlen calls,
+ add some more sanity checks.
+ * nis/nss_nisplus/nisplus-pwd.c: Include nisplus-parser.h for
+ parser prototype.
+
+1999-03-05 Thorsten Kukuk <kukuk@suse.de>
+
+ * sunrpc/rpc/xdr.h: Add x_getint32/x_putint32 to xdr_ops,
+ change XDR_GETINT32/XDR_PUTINT32 to sue new functions.
+ * sunrpc/xdr_mem.c: Add xdrmem_getint32, xdrmem_putint32.
+ * sunrpc/xdr_rec.c: Add xdrrec_getint32, xdrrec_putint32.
+ * sunrpc/xdr_sizeof.c: Add x_putint32, add dummy function
+ for x_getint32.
+ * sunrpc/xdr_stdio.c: Add xdrstdio_getint32, xdrstdio_putint32.
+ * nis/nis_print.c: Fix ctime argument for platforms where
+ sizeof (time_t) != sizeof (int).
+
1999-03-07 Mark Kettenis <kettenis@gnu.org>
* sysdeps/unix/bsd/clock.c (timeval_to_clock_t): Use
1999-03-05 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* resolv/inet_addr.c (inet_aton): Don't allow componets >
- 255. Patch by Bruno Haible <haible@ilog.fr> [PR libc/1010].
+ 255. Patch by Bruno Haible <haible@ilog.fr> [PR libc/1010].
1999-03-05 Geoff Keating <geoffk@ozemail.com.au>
3.18. After upgrading to glibc 2.1, I receive errors about
unresolved symbols, like `_dl_initial_searchlist' and can not
execute any binaries. What went wrong?
+3.19. bonnie reports that char i/o with glibc 2 is much slower than with
+ libc5. What can be done?
-4. bonnie reports that char i/o with glibc 2 is much slower than with
+4. Miscellaneous
-
-5. Miscellaneous
-
-5.1. After I changed configure.in I get `Autoconf version X.Y.
+4.1. After I changed configure.in I get `Autoconf version X.Y.
or higher is required for this script'. What can I do?
-5.2. When I try to compile code which uses IPv6 headers and
+4.2. When I try to compile code which uses IPv6 headers and
definitions on my Linux 2.x.y system I am in trouble.
Nothing seems to work.
-5.3. When I set the timezone by setting the TZ environment variable
+4.3. When I set the timezone by setting the TZ environment variable
to EST5EDT things go wrong since glibc computes the wrong time
from this information.
-5.4. What other sources of documentation about glibc are available?
-5.5. The timezone string for Sydney/Australia is wrong since even when
+4.4. What other sources of documentation about glibc are available?
+4.5. The timezone string for Sydney/Australia is wrong since even when
daylight saving time is in effect the timezone string is EST.
-5.6. I've build make 3.77 against glibc 2.1 and now make gets
+4.6. I've build make 3.77 against glibc 2.1 and now make gets
segmentation faults.
\f
have bugs and/or are missing features. Version 3.76 has bugs which
appear when building big projects like GNU libc. 3.76.1 appears to work but
some people have reported problems. If you build GNU make 3.77 from source,
-please read question 5.6 first.
+please read question 4.6 first.
1.4. Do I need a special linker or assembler?
Instead GNU libc contains zone database support and compatibility code for
POSIX TZ environment variable handling. For former is very much preferred
-(see question 5.3).
+(see question 4.3).
3.4. The prototypes for `connect', `accept', `getsockopt',
correct paths to the compiler (option -I with gcc) and linker (options
--dynamic-linker, -L and --rpath).
-\f
-. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-4. bonnie reports that char i/o with glibc 2 is much slower than with
+3.19. bonnie reports that char i/o with glibc 2 is much slower than with
+ libc5. What can be done?
+
+{AJ} The GNU C library uses thread safe functions by default and libc5 used
+non thread safe versions. The non thread safe functions have in glibc the
+suffix `_unlocked', for details check <stdio.h>. Using `putc_unlocked' etc.
+instead of `putc' should give nearly the same speed with bonnie (bonnie is a
+benchmark program for measuring disk access).
\f
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-5. Miscellaneous
+4. Miscellaneous
-5.1. After I changed configure.in I get `Autoconf version X.Y.
+4.1. After I changed configure.in I get `Autoconf version X.Y.
or higher is required for this script'. What can I do?
{UD} You have to get the specified autoconf version (or a later one)
from your favorite mirror of ftp.gnu.org.
-5.2. When I try to compile code which uses IPv6 headers and
+4.2. When I try to compile code which uses IPv6 headers and
definitions on my Linux 2.x.y system I am in trouble.
Nothing seems to work.
functions are not implemented.
-5.3. When I set the timezone by setting the TZ environment variable
+4.3. When I set the timezone by setting the TZ environment variable
to EST5EDT things go wrong since glibc computes the wrong time
from this information.
reading the POSIX standards.
-5.4. What other sources of documentation about glibc are available?
+4.4. What other sources of documentation about glibc are available?
{AJ} The FSF has a page about the GNU C library at
<http://www.gnu.org/software/libc/>. The problem data base of open and
Please note that this is not a complete list.
-5.5. The timezone string for Sydney/Australia is wrong since even when
+4.5. The timezone string for Sydney/Australia is wrong since even when
daylight saving time is in effect the timezone string is EST.
{UD} The problem for some timezones is that the local authorities decided
and regulations of the country this effects. glibc behaves correctly.
-5.6. I've build make 3.77 against glibc 2.1 and now make gets
+4.6. I've build make 3.77 against glibc 2.1 and now make gets
segmentation faults.
{AJ} GNU make 3.77 has support for 64 bit filesystems which is slightly
-/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
void
nis_print_object (const nis_object * obj)
{
+ time_t buf;
+
printf (_("Object Name : %s\n"), obj->zo_name);
printf (_("Directory : %s\n"), obj->zo_domain);
printf (_("Owner : %s\n"), obj->zo_owner);
nis_print_rights (obj->zo_access);
printf (_("\nTime to Live : "));
print_ttl (obj->zo_ttl);
- printf (_("Creation Time : %s"), ctime ((time_t *)&obj->zo_oid.ctime));
- printf (_("Mod. Time : %s"), ctime ((time_t *)&obj->zo_oid.mtime));
+ buf = obj->zo_oid.ctime;
+ printf (_("Creation Time : %s"), ctime (&buf));
+ buf = obj->zo_oid.mtime;
+ printf (_("Mod. Time : %s"), ctime (&buf));
fputs (_("Object Type : "), stdout);
nis_print_objtype (obj->zo_data.zo_type);
switch (obj->zo_data.zo_type)
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
{
char *first_unused = buffer;
size_t room_left = buflen;
+ size_t len;
if (result == NULL)
return 0;
strncpy (first_unused, NISENTRYVAL (0, 0, result),
NISENTRYLEN (0, 0, result));
first_unused[NISENTRYLEN (0, 0, result)] = '\0';
+ len = strlen (first_unused);
+ if (len == 0) /* No name ? Should never happen, database is corrupt */
+ return 0;
pw->pw_name = first_unused;
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN (0, 1, result) >= room_left)
goto no_more_room;
NISENTRYLEN (0, 1, result));
first_unused[NISENTRYLEN (0, 1, result)] = '\0';
pw->pw_passwd = first_unused;
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ len = strlen (first_unused);
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN(0, 2, result) >= room_left)
goto no_more_room;
strncpy (first_unused, NISENTRYVAL (0, 2, result),
NISENTRYLEN (0, 2, result));
first_unused[NISENTRYLEN (0, 2, result)] = '\0';
+ len = strlen (first_unused);
+ if (len == 0) /* If we don't have a uid, it's an invalid shadow entry */
+ return 0;
pw->pw_uid = atoi (first_unused);
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN (0, 3, result) >= room_left)
goto no_more_room;
strncpy (first_unused, NISENTRYVAL (0, 3, result),
NISENTRYLEN (0, 3, result));
first_unused[NISENTRYLEN (0, 3, result)] = '\0';
+ len = strlen (first_unused);
+ if (len == 0) /* If we don't have a gid, it's an invalid shadow entry */
+ return 0;
pw->pw_gid = atoi (first_unused);
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN(0, 4, result) >= room_left)
goto no_more_room;
NISENTRYLEN (0, 4, result));
first_unused[NISENTRYLEN (0, 4, result)] = '\0';
pw->pw_gecos = first_unused;
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ len = strlen (first_unused);
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN (0, 5, result) >= room_left)
goto no_more_room;
NISENTRYLEN (0, 5, result));
first_unused[NISENTRYLEN (0, 5, result)] = '\0';
pw->pw_dir = first_unused;
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ len = strlen (first_unused);
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN (0, 6, result) >= room_left)
goto no_more_room;
NISENTRYLEN (0, 6, result));
first_unused[NISENTRYLEN (0, 6, result)] = '\0';
pw->pw_shell = first_unused;
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ len = strlen (first_unused);
+ room_left -= (len + 1);
+ first_unused += (len + 1);
return 1;
}
size_t room_left = buflen;
char *line;
int count;
+ size_t len;
if (result == NULL)
return 0;
strncpy (first_unused, NISENTRYVAL (entry, 0, result),
NISENTRYLEN (entry, 0, result));
first_unused[NISENTRYLEN (entry, 0, result)] = '\0';
+ len = strlen (first_unused);
+ if (len == 0) /* group table is corrupt */
+ return 0;
gr->gr_name = first_unused;
- room_left -= (strlen (first_unused) + 1);
- first_unused += strlen (first_unused) + 1;
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN (entry, 1, result) >= room_left)
goto no_more_room;
NISENTRYLEN (entry, 1, result));
first_unused[NISENTRYLEN (entry, 1, result)] = '\0';
gr->gr_passwd = first_unused;
- room_left -= (strlen (first_unused) + 1);
- first_unused += strlen (first_unused) + 1;
+ len = strlen (first_unused);
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN (entry, 2, result) >= room_left)
goto no_more_room;
strncpy (first_unused, NISENTRYVAL (entry, 2, result),
NISENTRYLEN (entry, 2, result));
first_unused[NISENTRYLEN (entry, 2, result)] = '\0';
+ len = strlen (first_unused);
+ if (len == 0) /* We should always have an gid */
+ return 0;
gr->gr_gid = atoi (first_unused);
room_left -= (strlen (first_unused) + 1);
first_unused += strlen (first_unused) + 1;
NISENTRYLEN (entry, 3, result));
first_unused[NISENTRYLEN (entry, 3, result)] = '\0';
line = first_unused;
- room_left -= (strlen (line) + 1);
- first_unused += strlen (line) + 1;
+ len = strlen (line);
+ room_left -= (len + 1);
+ first_unused += (len + 1);
/* Adjust the pointer so it is aligned for
storing pointers. */
first_unused += __alignof__ (char *) - 1;
{
char *first_unused = buffer;
size_t room_left = buflen;
+ size_t len;
if (result == NULL)
return 0;
strncpy (first_unused, NISENTRYVAL (0, 0, result),
NISENTRYLEN (0, 0, result));
first_unused[NISENTRYLEN (0, 0, result)] = '\0';
+ len = strlen (first_unused);
+ if (len == 0)
+ return 0;
sp->sp_namp = first_unused;
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ room_left -= (len + 1);
+ first_unused += (len + 1);
if (NISENTRYLEN (0, 1, result) >= room_left)
goto no_more_room;
NISENTRYLEN (0, 1, result));
first_unused[NISENTRYLEN (0, 1, result)] = '\0';
sp->sp_pwdp = first_unused;
- room_left -= (strlen (first_unused) +1);
- first_unused += strlen (first_unused) +1;
+ len = strlen (first_unused);
+ room_left -= (len + 1);
+ first_unused += (len + 1);
sp->sp_lstchg = sp->sp_min = sp->sp_max = sp->sp_warn = sp->sp_inact =
sp->sp_expire = sp->sp_flag = -1;
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
#include <rpcsvc/nis.h>
#include "nss-nisplus.h"
+#include "nisplus-parser.h"
__libc_lock_define_initialized (static, lock)
static nis_name tablename_val = NULL;
static u_long tablename_len = 0;
-extern int _nss_nisplus_parse_pwent (nis_result *res, struct passwd *pw,
- char *buffer, size_t buflen, int *errnop);
-
static enum nss_status
_nss_create_tablename (int *errnop)
{
* XDR_FREE can be used to release the space allocated by an XDR_DECODE
* request.
*/
-enum xdr_op
- {
- XDR_ENCODE = 0,
- XDR_DECODE = 1,
- XDR_FREE = 2
- };
+enum xdr_op {
+ XDR_ENCODE = 0,
+ XDR_DECODE = 1,
+ XDR_FREE = 2
+};
/*
* This is the number of bytes per unit of external data.
/* buf quick ptr to buffered data */
void (*x_destroy) __PMT ((XDR *__xdrs));
/* free privates of this xdr_stream */
+ bool_t (*x_getint32) __PMT ((XDR *__xdrs, int32_t *__ip));
+ /* get a int from underlying stream */
+ bool_t (*x_putint32) __PMT ((XDR *__xdrs, __const int32_t *__ip));
+ /* put a int to " */
}
*x_ops;
caddr_t x_public; /* users' data */
* u_int pos;
*/
#define XDR_GETINT32(xdrs, int32p) \
- (*(xdrs)->x_ops->x_getlong)(xdrs, (long *)int32p)
+ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
#define xdr_getint32(xdrs, int32p) \
- (*(xdrs)->x_ops->x_getlong)(xdrs, (long *)int32p)
+ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
#define XDR_PUTINT32(xdrs, int32p) \
- (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)int32p)
+ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
#define xdr_putint32(xdrs, int32p) \
- (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)int32p)
+ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
#define XDR_GETLONG(xdrs, longp) \
(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
case 0:
goto fatal_err;
default:
+ if ((pollfd.revents & POLLERR) || (pollfd.revents & POLLHUP)
+ || (pollfd.revents & POLLNVAL))
+ goto fatal_err;
break;
- }
+ }
}
while ((pollfd.revents & POLLIN) == 0);
static bool_t xdrmem_setpos (XDR *, u_int);
static long *xdrmem_inline (XDR *, int);
static void xdrmem_destroy (XDR *);
+static bool_t xdrmem_getint32 (XDR *, int32_t *);
+static bool_t xdrmem_putint32 (XDR *, const int32_t *);
static const struct xdr_ops xdrmem_ops =
{
xdrmem_getpos,
xdrmem_setpos,
xdrmem_inline,
- xdrmem_destroy
+ xdrmem_destroy,
+ xdrmem_getint32,
+ xdrmem_putint32
};
/*
}
return buf;
}
+
+/*
+ * Gets the next word from the memory referenced by xdrs and places it
+ * in the int pointed to by ip. It then increments the private word to
+ * point at the next element. Neither object pointed to is const
+ */
+static bool_t
+xdrmem_getint32 (XDR *xdrs, int32_t *ip)
+{
+
+ if ((xdrs->x_handy -= 4) < 0)
+ return FALSE;
+ *ip = ntohl ((*((int32_t *) (xdrs->x_private))));
+ xdrs->x_private += 4;
+ return TRUE;
+}
+
+/*
+ * Puts the long pointed to by lp in the memory referenced by xdrs. It
+ * then increments the private word to point at the next element. The
+ * long pointed at is const
+ */
+static bool_t
+xdrmem_putint32 (XDR *xdrs, const int32_t *ip)
+{
+
+ if ((xdrs->x_handy -= 4) < 0)
+ return FALSE;
+ *(int32_t *) xdrs->x_private = htonl (*ip);
+ xdrs->x_private += 4;
+ return TRUE;
+}
static bool_t xdrrec_setpos (XDR *, u_int);
static long *xdrrec_inline (XDR *, int);
static void xdrrec_destroy (XDR *);
+static bool_t xdrrec_getint32 (XDR *, int32_t *);
+static bool_t xdrrec_putint32 (XDR *, const int32_t *);
static const struct xdr_ops xdrrec_ops =
{
xdrrec_getpos,
xdrrec_setpos,
xdrrec_inline,
- xdrrec_destroy
+ xdrrec_destroy,
+ xdrrec_getint32,
+ xdrrec_putint32
};
/*
return TRUE;
}
-static bool_t /* must manage buffers, fragments, and records */
-xdrrec_getbytes (xdrs, addr, len)
- XDR *xdrs;
- caddr_t addr;
- u_int len;
+static bool_t /* must manage buffers, fragments, and records */
+xdrrec_getbytes (XDR *xdrs, caddr_t addr, u_int len)
{
RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
u_int current;
mem_free ((caddr_t) rstrm, sizeof (RECSTREAM));
}
+static bool_t
+xdrrec_getint32 (XDR *xdrs, int32_t *ip)
+{
+ RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
+ int32_t *bufip = (int32_t *) rstrm->in_finger;
+ int32_t mylong;
+
+ /* first try the inline, fast case */
+ if (rstrm->fbtbc >= BYTES_PER_XDR_UNIT &&
+ rstrm->in_boundry - (char *) bufip >= BYTES_PER_XDR_UNIT)
+ {
+ *ip = ntohl (*bufip);
+ rstrm->fbtbc -= BYTES_PER_XDR_UNIT;
+ rstrm->in_finger += BYTES_PER_XDR_UNIT;
+ }
+ else
+ {
+ if (!xdrrec_getbytes (xdrs, (caddr_t) &mylong,
+ BYTES_PER_XDR_UNIT))
+ return FALSE;
+ *ip = ntohl (mylong);
+ }
+ return TRUE;
+}
+
+static bool_t
+xdrrec_putint32 (XDR *xdrs, const int32_t *ip)
+{
+ RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
+ int32_t *dest_ip = (int32_t *) rstrm->out_finger;
+
+ if ((rstrm->out_finger += BYTES_PER_XDR_UNIT) > rstrm->out_boundry)
+ {
+ /*
+ * this case should almost never happen so the code is
+ * inefficient
+ */
+ rstrm->out_finger -= BYTES_PER_XDR_UNIT;
+ rstrm->frag_sent = TRUE;
+ if (!flush_out (rstrm, FALSE))
+ return FALSE;
+ dest_ip = (int32_t *) rstrm->out_finger;
+ rstrm->out_finger += BYTES_PER_XDR_UNIT;
+ }
+ *dest_ip = htonl (*ip);
+ return TRUE;
+}
/*
* Exported routines to manage xdr records
return;
}
+static bool_t
+x_putint32 (XDR *xdrs, const int32_t *int32p)
+{
+ xdrs->x_handy += BYTES_PER_XDR_UNIT;
+ return TRUE;
+}
+
unsigned long
xdr_sizeof (xdrproc_t func, void *data)
{
/* to stop ANSI-C compiler from complaining */
typedef bool_t (*dummyfunc1) (XDR *, long *);
typedef bool_t (*dummyfunc2) (XDR *, caddr_t, u_int);
+ typedef bool_t (*dummyfunc3) (XDR *, int32_t *);
ops.x_putlong = x_putlong;
ops.x_putbytes = x_putbytes;
ops.x_getpostn = x_getpostn;
ops.x_setpostn = x_setpostn;
ops.x_destroy = x_destroy;
+ ops.x_putint32 = x_putint32;
/* the other harmless ones */
ops.x_getlong = (dummyfunc1) harmless;
ops.x_getbytes = (dummyfunc2) harmless;
+ ops.x_getint32 = (dummyfunc3) harmless;
x.x_op = XDR_ENCODE;
x.x_ops = &ops;
static bool_t xdrstdio_setpos (XDR *, u_int);
static long *xdrstdio_inline (XDR *, int);
static void xdrstdio_destroy (XDR *);
+static bool_t xdrstdio_getint32 (XDR *, int32_t *);
+static bool_t xdrstdio_putint32 (XDR *, const int32_t *);
/*
* Ops vector for stdio type XDR
xdrstdio_getpos, /* get offset in the stream */
xdrstdio_setpos, /* set offset in the stream */
xdrstdio_inline, /* prime stream for inline macros */
- xdrstdio_destroy /* destroy stream */
+ xdrstdio_destroy, /* destroy stream */
+ xdrstdio_getint32, /* deserialize a int */
+ xdrstdio_putint32 /* serialize a int */
};
/*
*/
return NULL;
}
+
+static bool_t
+xdrstdio_getint32 (XDR *xdrs, int32_t *ip)
+{
+ int32_t mycopy;
+
+ if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
+ return FALSE;
+ *ip = ntohl (mycopy);
+ return TRUE;
+}
+
+static bool_t
+xdrstdio_putint32 (XDR *xdrs, const int32_t *ip)
+{
+ int32_t mycopy = htonl (*ip);
+
+ ip = &mycopy;
+ if (fwrite ((caddr_t) ip, 4, 1, (FILE *) xdrs->x_private) != 1)
+ return FALSE;
+ return TRUE;
+}
{
static char *buf;
static size_t buflen = 0;
- static int dev_pts_available = 1;
char procname[30];
struct stat st, st1;
int dostat = 0;
- char *name = NULL;
+ char *name;
int save = errno;
if (!__isatty (fd))
if (__fxstat (_STAT_VER, fd, &st) < 0)
return NULL;
- if (dev_pts_available)
+ if (__xstat (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
{
- if (__xstat (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
- {
#ifdef _STATBUF_ST_RDEV
- name = getttyname ("/dev/pts", st.st_rdev, st.st_ino, save, &dostat);
+ name = getttyname ("/dev/pts", st.st_rdev, st.st_ino, save, &dostat);
#else
- name = getttyname ("/dev/pts", st.st_dev, st.st_ino, save, &dostat);
+ name = getttyname ("/dev/pts", st.st_dev, st.st_ino, save, &dostat);
#endif
- }
- else
- {
- __set_errno (save);
- dev_pts_available = 0;
- }
+ }
+ else
+ {
+ __set_errno (save);
+ name = NULL;
}
if (!name && dostat != -1)
char *buf;
size_t buflen;
{
- static int dev_pts_available = 1;
char procname[30];
struct stat st, st1;
int dostat = 0;
memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
buflen -= sizeof ("/dev/pts/") - 1;
- if (dev_pts_available)
+ if (__xstat (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode))
{
- if (__xstat (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode))
- {
#ifdef _STATBUF_ST_RDEV
- ret = getttyname_r (buf, buflen, st.st_rdev, st.st_ino, save,
- &dostat);
+ ret = getttyname_r (buf, buflen, st.st_rdev, st.st_ino, save,
+ &dostat);
#else
- ret = getttyname_r (buf, buflen, st.st_dev, st.st_ino, save,
- &dostat);
+ ret = getttyname_r (buf, buflen, st.st_dev, st.st_ino, save,
+ &dostat);
#endif
- }
- else
- {
- __set_errno (save);
- ret = ENOENT;
- dev_pts_available = 0;
- }
+ }
+ else
+ {
+ __set_errno (save);
+ ret = ENOENT;
}
if (ret && dostat != -1)