pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/devel/nbpatch nbpatch-20091021:
details: https://anonhg.NetBSD.org/pkgsrc/rev/1ec1a0d216e4
branches: trunk
changeset: 400530:1ec1a0d216e4
user: joerg <joerg%pkgsrc.org@localhost>
date: Wed Oct 21 17:17:04 2009 +0000
description:
nbpatch-20091021:
Do not try to mmap a zero length file. This can fail e.g. on Solaris.
diffstat:
devel/nbpatch/Makefile | 4 ++--
devel/nbpatch/files/inp.c | 16 ++++++++++------
2 files changed, 12 insertions(+), 8 deletions(-)
diffs (47 lines):
diff -r 9519b01b40e5 -r 1ec1a0d216e4 devel/nbpatch/Makefile
--- a/devel/nbpatch/Makefile Wed Oct 21 17:10:36 2009 +0000
+++ b/devel/nbpatch/Makefile Wed Oct 21 17:17:04 2009 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.3 2008/09/10 19:23:31 joerg Exp $
+# $NetBSD: Makefile,v 1.4 2009/10/21 17:17:04 joerg Exp $
#
-DISTNAME= nbpatch-20080910
+DISTNAME= nbpatch-20091021
CATEGORIES= devel
MASTER_SITES= # empty
DISTFILES= # empty
diff -r 9519b01b40e5 -r 1ec1a0d216e4 devel/nbpatch/files/inp.c
--- a/devel/nbpatch/files/inp.c Wed Oct 21 17:10:36 2009 +0000
+++ b/devel/nbpatch/files/inp.c Wed Oct 21 17:17:04 2009 +0000
@@ -1,7 +1,7 @@
/*
* $OpenBSD: inp.c,v 1.34 2006/03/11 19:41:30 otto Exp $
* $DragonFly: src/usr.bin/patch/inp.c,v 1.6 2007/09/29 23:11:10 swildner Exp $
- * $NetBSD: inp.c,v 1.5 2009/06/05 20:00:26 joerg Exp $
+ * $NetBSD: inp.c,v 1.6 2009/10/21 17:17:04 joerg Exp $
*/
/*
@@ -269,12 +269,16 @@
if ((ifd = open(filename, O_RDONLY)) < 0)
pfatal("can't open file %s", filename);
- i_womp = mmap(NULL, i_size, PROT_READ, MAP_PRIVATE, ifd, 0);
- if (i_womp == MAP_FAILED) {
- perror("mmap failed");
+ if (i_size) {
+ i_womp = mmap(NULL, i_size, PROT_READ, MAP_PRIVATE, ifd, 0);
+ if (i_womp == MAP_FAILED) {
+ perror("mmap failed");
+ i_womp = NULL;
+ close(ifd);
+ return false;
+ }
+ } else {
i_womp = NULL;
- close(ifd);
- return false;
}
close(ifd);
Home |
Main Index |
Thread Index |
Old Index