diff --git a/lib/commonio.c b/lib/commonio.c index b10da06a..31edbaaf 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -751,16 +751,16 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *)) for (ptr = db->head; (NULL != ptr) #if KEEP_NIS_AT_END - && (NULL != ptr->line) - && ( ('+' != ptr->line[0]) - && ('-' != ptr->line[0])) + && ((NULL == ptr->line) + || (('+' != ptr->line[0]) + && ('-' != ptr->line[0]))) #endif ; ptr = ptr->next) { n++; } #if KEEP_NIS_AT_END - if ((NULL != ptr) && (NULL != ptr->line)) { + if (NULL != ptr) { nis = ptr; } #endif