Skip to content

Commit

Permalink
fix empty suffix case.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoulasc committed May 26, 2010
1 parent 19264c8 commit 478b26f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions usr.bin/mkdep/mkdep.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: mkdep.c,v 1.34 2010/05/26 15:04:40 christos Exp $ */
/* $NetBSD: mkdep.c,v 1.35 2010/05/26 18:07:34 christos Exp $ */

/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -37,7 +37,7 @@
#if !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
All rights reserved.");
__RCSID("$NetBSD: mkdep.c,v 1.34 2010/05/26 15:04:40 christos Exp $");
__RCSID("$NetBSD: mkdep.c,v 1.35 2010/05/26 18:07:34 christos Exp $");
#endif /* not lint */

#include <sys/mman.h>
Expand Down Expand Up @@ -269,7 +269,7 @@ main(int argc, char **argv)
if (suff_list == NULL)
err(2, "malloc");
sl = suff_list;
for (s = suffixes; (s = strchr(s, '.')); s += sz, sl++ ) {
for (s = suffixes; (s = strchr(s, '.')); s += sz, sl++) {
sz = strcspn(s, ", ");
if (sz > sizeof sl->suff)
errx(2, "suffix too long");
Expand Down Expand Up @@ -368,7 +368,7 @@ main(int argc, char **argv)
* Not found, check for .o, since the
* original file will have it.
*/
if (sl->len == 0) {
if (sl->len == 0 && suff_list->len != 0) {
if (memcmp(suf - 2, ".o", 2) == 0)
slen = 2;
else
Expand Down

0 comments on commit 478b26f

Please sign in to comment.