summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl/parser.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-06-11 03:19:40 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-06-11 03:19:40 +0000
commit0b16912395fa760aa21ade032438caf30fb2f128 (patch)
tree1bcb066656173ba40dbfce90d5ede5cce3051156 /usr.sbin/bgpctl/parser.c
parentbe0a26acebcbc8e700ac55422bbb558b346893cf (diff)
getcwd can return NULL on error, so handle that case properly.
ok henning
Diffstat (limited to 'usr.sbin/bgpctl/parser.c')
-rw-r--r--usr.sbin/bgpctl/parser.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 1ee0ffea990..3ee603c0ad1 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.48 2008/06/07 18:14:41 henning Exp $ */
+/* $OpenBSD: parser.c,v 1.49 2008/06/11 03:19:39 tobias Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -329,7 +329,10 @@ parse(int argc, char *argv[])
res.community.as = COMMUNITY_UNSET;
res.community.type = COMMUNITY_UNSET;
TAILQ_INIT(&res.set);
- res.irr_outdir = getcwd(NULL, 0);
+ if ((res.irr_outdir = getcwd(NULL, 0)) == NULL) {
+ fprintf(stderr, "getcwd failed: %s", strerror(errno));
+ return (NULL);
+ }
while (argc >= 0) {
if ((match = match_token(&argc, &argv, table)) == NULL) {