}
}
-
-static char *
+static void
write_all_states(char *buff, unsigned int states)
{
unsigned int lowbit;
- buff[0] = '\0';
+ *buff = '\0';
/* A trick for computing the lowest set bit. */
while ((lowbit = states & (1 + ~states)) != 0) {
if (states != 0)
strcat(buff, "/");
}
- return buff;
}
/*
if ((a->state & state) == 0) {
/* If we're already FATAL, don't overwrite the error. */
- if (a->state != ARCHIVE_STATE_FATAL)
+ if (a->state != ARCHIVE_STATE_FATAL) {
+ write_all_states(states1, a->state);
+ write_all_states(states2, state);
archive_set_error(a, -1,
"INTERNAL ERROR: Function '%s' invoked with"
" archive structure in state '%s',"
" should be in state '%s'",
function,
- write_all_states(states1, a->state),
- write_all_states(states2, state));
+ states1,
+ states2);
+ }
a->state = ARCHIVE_STATE_FATAL;
return (ARCHIVE_FATAL);
}
- return ARCHIVE_OK;
+ return (ARCHIVE_OK);
}