pkgsrc-Bugs archive

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

Re: pkg/45289: Using pkg_add command from pkgsrc on Solaris 10 zones



The following reply was made to PR pkg/45289; it has been noted by GNATS.

From: Thomas Klausner <wiz%NetBSD.org@localhost>
To: NetBSD bugtracking <gnats-bugs%NetBSD.org@localhost>
Cc: 
Subject: Re: pkg/45289: Using pkg_add command from pkgsrc on Solaris 10 zones
Date: Fri, 26 Aug 2011 10:18:56 +0200

 On Wed, Aug 24, 2011 at 11:55:00AM +0000, tlusty%vse.cz@localhost wrote:
 > --- perform.c?rev=1.99  2010-12-12 14:18:38.000000000 +0100
 > +++ perform.c   2011-08-19 15:40:06.000000000 +0200
 > @@ -59,7 +59,9 @@
 >  #include "lib.h"
 >  #include "add.h"
 >  #include "version.h"
 > +#include <dirent.h>
 > 
 > +DIR *dir_pointer;
 >  struct pkg_meta {
 >         char *meta_contents;
 >         char *meta_comment;
 > @@ -175,11 +177,14 @@
 >          * Handle the easy case of direct success or
 >          * pre-existing directory first.
 >          */
 > -       if (mkdir(path, 0777) == 0 || errno == EEXIST)
 > -               return 0;
 > -       if (errno != ENOENT)
 > -               return -1;
 > -
 > +       dir_pointer = opendir (path);
 > +       if (dir_pointer == NULL) {
 > +           if (mkdir(path, 0777) == 0 || errno == EEXIST)
 > +                   return 0;
 > +           if (errno != ENOENT)
 > +                   return -1;
 > +       }
 > +       (void) closedir (dir_pointer);
 >         cur_end = p = xstrdup(path);
 > 
 >         for (;;) {
 
 I think you should only call closedir if dir_pointer is != NULL, i.e.
 move it in the if statement.
  Thomas
 


Home | Main Index | Thread Index | Old Index