pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/pkgsrc-2009Q3]: pkgsrc/devel/nbpatch Pullup ticket #2917 - requested ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f36017e8a083
branches:  pkgsrc-2009Q3
changeset: 399946:f36017e8a083
user:      tron <tron%pkgsrc.org@localhost>
date:      Thu Oct 22 11:03:18 2009 +0000

description:
Pullup ticket #2917 - requested by joerg
nbpatch: portability fix

Revisions pulled up:
- devel/nbpatch/Makefile                1.4
- devel/nbpatch/files/inp.c             1.6
---
Module Name:    pkgsrc
Committed By:   joerg
Date:           Wed Oct 21 17:17:04 UTC 2009

Modified Files:
        pkgsrc/devel/nbpatch: Makefile
        pkgsrc/devel/nbpatch/files: inp.c

Log Message:
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 a7acdd6428c8 -r f36017e8a083 devel/nbpatch/Makefile
--- a/devel/nbpatch/Makefile    Wed Oct 21 12:44:50 2009 +0000
+++ b/devel/nbpatch/Makefile    Thu Oct 22 11:03:18 2009 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.3 2008/09/10 19:23:31 joerg Exp $
+# $NetBSD: Makefile,v 1.3.12.1 2009/10/22 11:03:18 tron Exp $
 #
 
-DISTNAME=      nbpatch-20080910
+DISTNAME=      nbpatch-20091021
 CATEGORIES=    devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r a7acdd6428c8 -r f36017e8a083 devel/nbpatch/files/inp.c
--- a/devel/nbpatch/files/inp.c Wed Oct 21 12:44:50 2009 +0000
+++ b/devel/nbpatch/files/inp.c Thu Oct 22 11:03:18 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.5.4.1 2009/10/22 11:03:18 tron 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