Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdlib return the same errors as linux for ptsname_r
details: https://anonhg.NetBSD.org/src/rev/d936b3ce3d87
branches: trunk
changeset: 325830:d936b3ce3d87
user: christos <christos%NetBSD.org@localhost>
date: Wed Jan 08 02:17:30 2014 +0000
description:
return the same errors as linux for ptsname_r
diffstat:
lib/libc/stdlib/ptsname.3 | 9 +++++++--
lib/libc/stdlib/pty.c | 8 +++++---
2 files changed, 12 insertions(+), 5 deletions(-)
diffs (54 lines):
diff -r 865438c66c7c -r d936b3ce3d87 lib/libc/stdlib/ptsname.3
--- a/lib/libc/stdlib/ptsname.3 Wed Jan 08 02:15:42 2014 +0000
+++ b/lib/libc/stdlib/ptsname.3 Wed Jan 08 02:17:30 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ptsname.3,v 1.7 2014/01/08 02:15:42 christos Exp $
+.\" $NetBSD: ptsname.3,v 1.8 2014/01/08 02:17:30 christos Exp $
.\"
.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -115,7 +115,12 @@
function
will return:
.Bl -tag -width Er
-.It Bq Er ENOSPC
+.It Bq Er EINVAL
+the
+.Fa buf
+argument is
+.Dv NULL .
+.It Bq Er ERANGE
the name of the pseudo-terminal is longer than
.Fa bufsiz
characters plus the terminating
diff -r 865438c66c7c -r d936b3ce3d87 lib/libc/stdlib/pty.c
--- a/lib/libc/stdlib/pty.c Wed Jan 08 02:15:42 2014 +0000
+++ b/lib/libc/stdlib/pty.c Wed Jan 08 02:17:30 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pty.c,v 1.3 2014/01/08 02:15:42 christos Exp $ */
+/* $NetBSD: pty.c,v 1.4 2014/01/08 02:17:30 christos Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pty.c,v 1.3 2014/01/08 02:15:42 christos Exp $");
+__RCSID("$NetBSD: pty.c,v 1.4 2014/01/08 02:17:30 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -71,9 +71,11 @@
ptsname_r(int fildes, char *buf, size_t buflen) {
struct ptmget pm;
+ if (buf == NULL)
+ return EINVAL;
if (ioctl(fildes, TIOCPTSNAME, &pm) == -1)
return errno;
if (strlcpy(buf, pm.sn, buflen) > buflen)
- return ENOSPC;
+ return ERANGE;
return 0;
}
Home |
Main Index |
Thread Index |
Old Index