RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: popt/ CHANGES poptconfig.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Sat 06 Oct 2007 - 04:14:42 CEST
Message-Id: <20071006021442.AB41034845D@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: popt                             Date:   06-Oct-2007 04:14:42
  Branch: HEAD                             Handle: 2007100603144200

  Modified files:
    popt                    CHANGES poptconfig.c

  Log:
    - bero: read /etc/popt.d/* files.

  Summary:
    Revision    Changes     Path
    1.25        +1  -0      popt/CHANGES
    1.31        +23 -0      popt/poptconfig.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: popt/CHANGES
  ============================================================================
  $ cvs diff -u -r1.24 -r1.25 CHANGES
  --- popt/CHANGES	14 Sep 2007 11:41:35 -0000	1.24
  +++ popt/CHANGES	6 Oct 2007 02:14:42 -0000	1.25
  @@ -1,4 +1,5 @@
   1.12 -> 1.13:
  +    - bero: read /etc/popt.d/* files.
       - jbj: don't read /etc/popt twice (#290531).
       - jbj: isspace(3) has i18n encoding signednesss issues on Solaris (#172393).
       - jbj: refactor column cursor to a structure, carry maxcols as well.
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/poptconfig.c
  ============================================================================
  $ cvs diff -u -r1.30 -r1.31 poptconfig.c
  --- popt/poptconfig.c	14 Sep 2007 11:41:35 -0000	1.30
  +++ popt/poptconfig.c	6 Oct 2007 02:14:42 -0000	1.31
  @@ -8,6 +8,8 @@
   
   #include "system.h"
   #include "poptint.h"
  +#include <sys/stat.h>
  +#include <glob.h>
   /*@access poptContext @*/
   
   /*@-compmempass@*/	/* FIX: item->option.longName kept, not dependent. */
  @@ -171,6 +173,7 @@
       static const char _popt_sysconfdir[] = POPT_SYSCONFDIR "/popt";
       static const char _popt_etc[] = "/etc/popt";
       char * fn, * home;
  +    struct stat s;
       int rc;
   
       if (con->appName == NULL) return 0;
  @@ -183,6 +186,26 @@
       rc = poptReadConfigFile(con, _popt_etc);
       if (rc) return rc;
   
  +    stat("/etc/popt.d", &s);
  +    if(S_ISDIR(s.st_mode)) {
  +        glob_t g;
  +	if (!glob("/etc/popt.d/*", 0, NULL, &g)) {
  +            int i;
  +	    for (i=0; i<g.gl_pathc; i++) {
  +		char *f=g.gl_pathv[i];
  +		if (strstr(f, ".rpmnew") || strstr(f, ".rpmsave"))
  +		    continue;
  +		if (!stat(f, &s)) {
  +		    if (!S_ISREG(s.st_mode) && !S_ISLNK(s.st_mode))
  +			continue;
  +		}
  +		rc = poptReadConfigFile(con, f);
  +		if (rc) return rc;
  +	    }
  +	    globfree(&g);
  +	}
  +    }
  +
       if ((home = getenv("HOME"))) {
   	fn = malloc(strlen(home) + 20);
   	strcpy(fn, home);
  @@ .
Received on Sat Oct 6 04:14:42 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.