diff options
author | devzero2000 <devzero2000> | 2011-06-16 15:26:43 +0000 |
---|---|---|
committer | devzero2000 <devzero2000> | 2011-06-16 15:26:43 +0000 |
commit | 97b370a448a90f3d337ca3e9ddbc9e5b399bf876 (patch) | |
tree | 0c09faf3450092290f1e0fd3cf919fa504b5323d | |
parent | 87145671073d51217097fcaf10f920eb141b9100 (diff) | |
download | libpopt-97b370a448a90f3d337ca3e9ddbc9e5b399bf876.tar.gz |
fix compiler warning -Wunused-but-set-variable (GCC 4.6)
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | popt.c | 12 | ||||
-rw-r--r-- | poptconfig.c | 3 | ||||
-rw-r--r-- | popthelp.c | 18 |
4 files changed, 19 insertions, 15 deletions
@@ -1,4 +1,5 @@ 1.17 -> 2.0: + - devzero2000: fix compiler warning -Wunused-but-set-variable (GCC 4.6) - devzero2000: redo the autofu vendor-script linker script check for openindiana native ld, using modern and not deprecated autoconf construct. Even if the check is not perfect but it is based on a resultant ld warning, on openindiana the result actually work @@ -510,7 +510,6 @@ static int execCommand(poptContext con) poptItem item = con->doExec; poptArgv argv = NULL; int argc = 0; - int rc; int ec = POPT_ERROR_ERRNO; assert(item); /*XXX can't happen*/ @@ -557,10 +556,13 @@ assert(argv); /* XXX can't happen */ argv[argc] = NULL; #if defined(hpux) || defined(__hpux) + { + int rc; rc = setresgid(getgid(), getgid(),-1); if (rc) goto exit; rc = setresuid(getuid(), getuid(),-1); if (rc) goto exit; + } #else /* * XXX " ... on BSD systems setuid() should be preferred over setreuid()" @@ -568,15 +570,21 @@ assert(argv); /* XXX can't happen */ * XXX from Norbert Warmuth <nwarmuth@privat.circular.de> */ #if defined(HAVE_SETUID) + { + int rc; rc = setgid(getgid()); if (rc) goto exit; rc = setuid(getuid()); if (rc) goto exit; + } #elif defined (HAVE_SETREUID) + { + int rc; rc = setregid(getgid(), getgid()); if (rc) goto exit; rc = setreuid(getuid(), getuid()); if (rc) goto exit; + } #else ; /* Can't drop privileges */ #endif @@ -593,7 +601,7 @@ if (_popt_debug) #endif /*@-nullstate@*/ - rc = execvp(argv[0], (char *const *)argv); + execvp(argv[0], (char *const *)argv); /*@=nullstate@*/ exit: diff --git a/poptconfig.c b/poptconfig.c index 2355976..f44be33 100644 --- a/poptconfig.c +++ b/poptconfig.c @@ -411,8 +411,7 @@ int poptReadConfigFile(poptContext con, const char * fn) te = t; while (*te && _isspaceptr(te)) te++; if (*te && *te != '#') { - int xx; - xx = poptConfigLine(con, te); /* XXX: unchecked */ + poptConfigLine(con, te); /* XXX: unchecked */ } /*@switchbreak@*/ break; /*@-usedef@*/ /* XXX *se may be uninitialized */ @@ -332,7 +332,6 @@ static void singleOptionHelp(FILE * fp, columns_t columns, char * left; size_t nb = maxLeftCol + 1; int displaypad = 0; - int xx; /* Make sure there's more than enough room in target buffer. */ if (opt->longName) nb += strlen(opt->longName); @@ -468,9 +467,9 @@ assert(t); /* XXX can't happen */ } if (help) - xx = POPT_fprintf(fp," %-*s ", (int)(maxLeftCol+displaypad), left); + POPT_fprintf(fp," %-*s ", (int)(maxLeftCol+displaypad), left); else { - xx = POPT_fprintf(fp," %s\n", left); + POPT_fprintf(fp," %s\n", left); goto out; } @@ -500,7 +499,7 @@ assert(t); /* XXX can't happen */ fmthelp[ch - help] = '\0'; sprintf(format, "%%s\n%%%ds", (int) indentLength); /*@-formatconst@*/ - xx = POPT_fprintf(fp, format, fmthelp, " "); + POPT_fprintf(fp, format, fmthelp, " "); /*@=formatconst@*/ free(fmthelp); } @@ -641,8 +640,7 @@ static void singleTableHelp(poptContext con, FILE * fp, if (opt->arg == poptAliasOptions && !(con->numAliases || con->numExecs)) continue; if (opt->descrip) { - int xx; - xx = POPT_fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip)); /* XXX: unchecked */ + POPT_fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip)); /* XXX: unchecked */ } singleTableHelp(con, fp, opt->arg, columns, sub_transdom); @@ -658,9 +656,8 @@ static size_t showHelpIntro(poptContext con, FILE * fp) /*@modifies fp, fileSystem @*/ { size_t len = (size_t)6; - int xx; - xx = POPT_fprintf(fp, POPT_("Usage:")); + POPT_fprintf(fp, POPT_("Usage:")); if (!(con->flags & POPT_CONTEXT_KEEP_FIRST)) { struct optionStackEntry * os = con->optionStack; const char * fn = (os->argv ? os->argv[0] : NULL); @@ -679,14 +676,13 @@ static size_t showHelpIntro(poptContext con, FILE * fp) void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ UNUSED(int flags)) { columns_t columns = (columns_t) xcalloc((size_t)1, sizeof(*columns)); - int xx; assert(columns); /* XXX can't happen */ (void) showHelpIntro(con, fp); if (con->otherHelp) - xx = POPT_fprintf(fp, " %s\n", con->otherHelp); + POPT_fprintf(fp, " %s\n", con->otherHelp); else - xx = POPT_fprintf(fp, " %s\n", POPT_("[OPTION...]")); + POPT_fprintf(fp, " %s\n", POPT_("[OPTION...]")); if (columns) { columns->cur = maxArgWidth(con->options, NULL); |