char name[NAMESZ], field[BUFSIZ];
char *cp;
char *msgnums = NULL, *this_msgnums, *old_msgnums;
+ int failed_to_lock = 0;
m_getfld_state_t gstate = 0;
/* copied from seq_read.c:seq_public */
if (seqfile == NULL)
return NULL;
- if ((fp = lkfopendata (seqfile, "r")) == NULL) {
- free(seqfile);
+ if ((fp = lkfopendata (seqfile, "r", & failed_to_lock)) == NULL) {
- if (errno == EACCES || errno == EAGAIN || errno == EWOULDBLOCK) {
- /* Failed to lock sequence file. */
+ if (failed_to_lock) {
adios (seqfile, "failed to lock");
} else {
+ free(seqfile);
return NULL;
}
}
/* If we're fnext, we haven't checked the last node yet. If it's the
* current folder, return the first node. */
- if (run_mode == FNEXT && strcmp(last->n_name, cur) == 0) {
- return first;
+ if (run_mode == FNEXT) {
+ assert(last != NULL);
+ if (strcmp(last->n_name, cur) == 0) {
+ return first;
+ }
}
if (run_mode == NEW) {