- popt: add POPT_CONTEXT_ARG_OPTS for all opts to return 1 (#30912).

- fix: fsm reads/writes now return error on partial I/O.
- fix: Ferror returned spurious error for gzdio/bzdio.

CVS patchset: 4874
CVS date: 2001/06/17 15:19:26
This commit is contained in:
jbj 2001-06-17 15:19:26 +00:00
parent 6f3943da6c
commit c32276cdf5
6 changed files with 37 additions and 26 deletions

View File

@ -114,6 +114,9 @@
%post -p "/sbin/ldconfig -n /usr/lib"
incompatibilities.
- popt: add POPT_ARGFLAG_SHOW_DEFAULT to display initial values(#32558).
- popt: add POPT_CONTEXT_ARG_OPTS for all opts to return 1 (#30912).
- fix: fsm reads/writes now return error on partial I/O.
- fix: Ferror returned spurious error for gzdio/bzdio.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.

View File

@ -1913,10 +1913,8 @@ int fsmStage(FSM_t fsm, fileStage stage)
cur, (fsm->wrbuf == fsm->wrb ? "wrbuf" : "mmap"),
(int)fsm->wrlen, (int)fsm->rdnb);
if (fsm->rdnb != fsm->wrlen) fprintf(stderr, "*** short read, had %d, got %d\n", (int)fsm->rdnb, (int)fsm->wrlen);
#ifdef NOTYET
if (Ferror(fsm->rfd))
if (fsm->rdnb != fsm->wrlen || Ferror(fsm->cfd))
rc = CPIOERR_READ_FAILED;
#endif
if (fsm->rdnb > 0)
fdSetCpioPos(fsm->cfd, fdGetCpioPos(fsm->cfd) + fsm->rdnb);
break;
@ -1927,10 +1925,8 @@ if (fsm->rdnb != fsm->wrlen) fprintf(stderr, "*** short read, had %d, got %d\n",
cur, (fsm->rdbuf == fsm->rdb ? "rdbuf" : "mmap"),
(int)fsm->rdnb, (int)fsm->wrnb);
if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write, had %d, got %d\n", (int)fsm->rdnb, (int)fsm->wrnb);
#ifdef NOTYET
if (Ferror(fsm->wfd))
if (fsm->rdnb != fsm->wrnb || Ferror(fsm->cfd))
rc = CPIOERR_WRITE_FAILED;
#endif
if (fsm->wrnb > 0)
fdSetCpioPos(fsm->cfd, fdGetCpioPos(fsm->cfd) + fsm->wrnb);
break;
@ -1953,10 +1949,8 @@ if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write, had %d, got %d\n",
rpmMessage(RPMMESS_DEBUG, " %8s (rdbuf, %d, rfd)\trdnb %d\n",
cur, (int)fsm->rdlen, (int)fsm->rdnb);
if (fsm->rdnb != fsm->rdlen) fprintf(stderr, "*** short read, had %d, got %d\n", (int)fsm->rdnb, (int)fsm->rdlen);
#ifdef NOTYET
if (Ferror(fsm->rfd))
if (fsm->rdnb != fsm->rdlen || Ferror(fsm->rfd))
rc = CPIOERR_READ_FAILED;
#endif
break;
case FSM_RCLOSE:
if (fsm->rfd) {
@ -1984,10 +1978,8 @@ if (fsm->rdnb != fsm->rdlen) fprintf(stderr, "*** short read, had %d, got %d\n",
rpmMessage(RPMMESS_DEBUG, " %8s (wrbuf, %d, wfd)\twrnb %d\n",
cur, (int)fsm->rdnb, (int)fsm->wrnb);
if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write: had %d, got %d\n", (int)fsm->rdnb, (int)fsm->wrnb);
#ifdef NOTYET
if (Ferror(fsm->wfd))
if (fsm->rdnb != fsm->wrnb || Ferror(fsm->wfd))
rc = CPIOERR_WRITE_FAILED;
#endif
break;
case FSM_WCLOSE:
if (fsm->wfd) {

View File

@ -675,10 +675,14 @@ int poptGetNextOpt(poptContext con)
return POPT_ERROR_BADOPT;
if (con->restLeftover || *origOptString != '-') {
if (con->leftovers != NULL) /* XXX can't happen */
con->leftovers[con->numLeftovers++] = origOptString;
if (con->flags & POPT_CONTEXT_POSIXMEHARDER)
con->restLeftover = 1;
if (con->flags & POPT_CONTEXT_ARG_OPTS) {
con->os->nextArg = xstrdup(origOptString);
return 0;
}
if (con->leftovers != NULL) /* XXX can't happen */
con->leftovers[con->numLeftovers++] = origOptString;
continue;
}
@ -793,10 +797,11 @@ int poptGetNextOpt(poptContext con)
cleanOSE(con->os--);
}
if (con->os->next == con->os->argc) {
if (opt->argInfo & POPT_ARGFLAG_OPTIONAL)
con->os->nextArg = NULL;
else
if (!(opt->argInfo & POPT_ARGFLAG_OPTIONAL))
/*@-compdef@*/ /* FIX: con->os->argv not defined */
return POPT_ERROR_NOARG;
/*@=compdef@*/
con->os->nextArg = NULL;
} else {
/*

View File

@ -110,6 +110,7 @@ extern "C" {
#define POPT_CONTEXT_NO_EXEC (1 << 0) /*!< ignore exec expansions */
#define POPT_CONTEXT_KEEP_FIRST (1 << 1) /*!< pay attention to argv[0] */
#define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /*!< options can't follow args */
#define POPT_CONTEXT_ARG_OPTS (1 << 4) /*!< return args as options with value 0 */
/*@}*/
/** \ingroup popt

View File

@ -81,18 +81,22 @@ getArgDescrip(const struct poptOption * opt,
static /*@only@*/ /*@null@*/ char * singleOptionDefaultValue(int lineLength,
const struct poptOption * opt,
/*@null@*/ const char *translation_domain)
/*@-paramuse@*/ /* FIX: i18n macros disable with lclint */
/*@null@*/ const char * translation_domain)
/*@=paramuse@*/
/*@*/
{
const char * defstr = D_(translation_domain, "default");
char * l = malloc(4*lineLength + 1);
char * le = l;
char * le = malloc(4*lineLength + 1);
char * l = le;
if (l == NULL) return l; /* XXX can't happen */
if (l == NULL) return NULL; /* XXX can't happen */
*le = '\0';
*le++ = '(';
le = stpcpy(le, defstr);
*le++ = ':';
*le++ = ' ';
if (opt->arg) /* XXX programmer error */
switch (opt->argInfo & POPT_ARG_MASK) {
case POPT_ARG_VAL:
case POPT_ARG_INT:
@ -128,7 +132,7 @@ static /*@only@*/ /*@null@*/ char * singleOptionDefaultValue(int lineLength,
default:
l = _free(l);
return NULL;
break;
/*@notreached@*/ break;
}
*le++ = ')';
*le = '\0';
@ -138,7 +142,7 @@ static /*@only@*/ /*@null@*/ char * singleOptionDefaultValue(int lineLength,
static void singleOptionHelp(FILE * fp, int maxLeftCol,
const struct poptOption * opt,
/*@null@*/ const char *translation_domain)
/*@null@*/ const char * translation_domain)
/*@modifies *fp, fileSystem @*/
{
int indentLength = maxLeftCol + 5;
@ -180,9 +184,13 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol,
if (opt->argInfo & POPT_ARGFLAG_SHOW_DEFAULT) {
defs = singleOptionDefaultValue(lineLength, opt, translation_domain);
if (defs) {
char * t = malloc(strlen(help) + strlen(defs) + sizeof(" "));
char * t = malloc((help ? strlen(help) : 0) +
strlen(defs) + sizeof(" "));
if (t) {
(void) stpcpy( stpcpy( stpcpy(t, help), " "), defs);
char * te = t;
*te = '\0';
if (help) te = stpcpy(te, help);
(void) stpcpy( stpcpy( te, " "), defs);
defs = _free(defs);
}
defs = t;

View File

@ -2796,10 +2796,12 @@ int Ferror(FD_t fd)
ec = ferror(fdGetFILE(fd));
/*@=voidabstract =nullpass@*/
} else if (fps->io == gzdio) {
ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
i--; /* XXX fdio under gzdio always has fdno == -1 */
#if HAVE_BZLIB_H
} else if (fps->io == bzdio) {
ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
i--; /* XXX fdio under bzdio always has fdno == -1 */
#endif
} else {
/* XXX need to check ufdio/gzdio/bzdio/fdio errors correctly. */