Module Name: src
Committed By: christos
Date: Wed Jan 8 02:17:30 UTC 2014
Modified Files:
src/lib/libc/stdlib: ptsname.3 pty.c
Log Message:
return the same errors as linux for ptsname_r
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/stdlib/ptsname.3
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/stdlib/pty.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdlib/ptsname.3
diff -u src/lib/libc/stdlib/ptsname.3:1.7 src/lib/libc/stdlib/ptsname.3:1.8
--- src/lib/libc/stdlib/ptsname.3:1.7 Tue Jan 7 21:15:42 2014
+++ src/lib/libc/stdlib/ptsname.3 Tue Jan 7 21:17:30 2014
@@ -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 @@ In addition the
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
Index: src/lib/libc/stdlib/pty.c
diff -u src/lib/libc/stdlib/pty.c:1.3 src/lib/libc/stdlib/pty.c:1.4
--- src/lib/libc/stdlib/pty.c:1.3 Tue Jan 7 21:15:42 2014
+++ src/lib/libc/stdlib/pty.c Tue Jan 7 21:17:30 2014
@@ -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 @@ int
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;
}