pkgsrc-Users archive

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

Re: Broken nbpatch on Solaris?



On Mon, Oct 19, 2009 at 07:42:00PM +0100, raymond.meyer%rambler.ru@localhost 
wrote:
> Your patch is wrong, I added a debug printf line to inp.c which showed
> the following:
> 
> => Applying pkgsrc patches for kdelibs-3.5.10nb4
> mmap failed: Invalid argument
> i_size=0, filename=kinit/main.cpp
> No such line 864 in input file, ignoring

Why didn't you say so in first place? :) New patch attached.

Joerg
Index: files/inp.c
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/devel/nbpatch/files/inp.c,v
retrieving revision 1.5
diff -u -p -r1.5 inp.c
--- files/inp.c 5 Jun 2009 20:00:26 -0000       1.5
+++ files/inp.c 19 Oct 2009 19:02:34 -0000
@@ -269,12 +269,16 @@ plan_a(const char *filename)
        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