NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/51894: [PATCH] tests/lib/libc/ssp/h_read: various fixes
The following reply was made to PR bin/51894; it has been noted by GNATS.
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/51894: [PATCH] tests/lib/libc/ssp/h_read: various fixes
Date: Sun, 15 Jan 2017 13:35:29 -0800
--Apple-Mail=_B3231C21-B7C5-494D-8C4F-95756A4B3F20
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Patch attached.
-Ngie
--Apple-Mail=_B3231C21-B7C5-494D-8C4F-95756A4B3F20
Content-Disposition: attachment;
filename=h_read-various-fixes.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="h_read-various-fixes.patch"
Content-Transfer-Encoding: 7bit
Index: lib/libc/ssp/h_read.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/ssp/h_read.c,v
retrieving revision 1.1
diff -u -r1.1 h_read.c
--- lib/libc/ssp/h_read.c 27 Dec 2010 02:04:19 -0000 1.1
+++ lib/libc/ssp/h_read.c 15 Jan 2017 21:30:11 -0000
@@ -32,6 +32,8 @@
__RCSID("$NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
#include <sys/param.h>
+#include <fcntl.h>
+#include <paths.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -40,8 +42,13 @@
main(int argc, char *argv[])
{
char b[MAXPATHLEN];
+ int fd, n;
size_t len = atoi(argv[1]);
- (void)read(0, b, len);
+
+ if ((fd = open(_PATH_DEVZERO, O_RDONLY)) == -1)
+ abort();
+ if ((n = read(fd, b, len)) == -1)
+ abort();
(void)printf("%s\n", b);
- return 0;
+ return (0);
}
--Apple-Mail=_B3231C21-B7C5-494D-8C4F-95756A4B3F20--
Home |
Main Index |
Thread Index |
Old Index