diff options
author | Peter Valchev <pvalchev@cvs.openbsd.org> | 2003-04-25 20:07:10 +0000 |
---|---|---|
committer | Peter Valchev <pvalchev@cvs.openbsd.org> | 2003-04-25 20:07:10 +0000 |
commit | e294f1e17d0e66df5e6f777424a6fa89f3dd1a63 (patch) | |
tree | 1ee310fde6f677d6f3151193815430dba5ad415a /usr.bin/ctags | |
parent | 14f6abdffc727eeddbcea128909598e7ffd9dfaa (diff) |
check asprintf return value for error, as the pointer is not guaranteed
to be NULL in such case; ok millert
Diffstat (limited to 'usr.bin/ctags')
-rw-r--r-- | usr.bin/ctags/ctags.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/ctags/ctags.c b/usr.bin/ctags/ctags.c index bb69b3aa7a6..0affda6c26e 100644 --- a/usr.bin/ctags/ctags.c +++ b/usr.bin/ctags/ctags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctags.c,v 1.7 2003/04/07 21:13:54 deraadt Exp $ */ +/* $OpenBSD: ctags.c,v 1.8 2003/04/25 20:07:09 pvalchev Exp $ */ /* $NetBSD: ctags.c,v 1.4 1995/09/02 05:57:23 jtc Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95"; #endif -static char rcsid[] = "$OpenBSD: ctags.c,v 1.7 2003/04/07 21:13:54 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ctags.c,v 1.8 2003/04/25 20:07:09 pvalchev Exp $"; #endif /* not lint */ #include <err.h> @@ -160,10 +160,9 @@ usage: (void)fprintf(stderr, else { if (uflag) { for (step = 0; step < argc; step++) { - (void)asprintf(&cmd, + if (asprintf(&cmd, "mv %s OTAGS; fgrep -v '\t%s\t' OTAGS >%s; rm OTAGS", - outfile, argv[step], outfile); - if (cmd == NULL) + outfile, argv[step], outfile) == -1) err(1, "out of space"); system(cmd); free(cmd); @@ -176,9 +175,8 @@ usage: (void)fprintf(stderr, put_entries(head); (void)fclose(outf); if (uflag) { - (void)asprintf(&cmd, "sort -o %s %s", - outfile, outfile); - if (cmd == NULL) + if (asprintf(&cmd, "sort -o %s %s", + outfile, outfile) == -1) err(1, "out of space"); system(cmd); free(cmd); |