diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-06-11 03:19:40 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-06-11 03:19:40 +0000 |
commit | 0b16912395fa760aa21ade032438caf30fb2f128 (patch) | |
tree | 1bcb066656173ba40dbfce90d5ede5cce3051156 /usr.sbin/bgpctl/parser.c | |
parent | be0a26acebcbc8e700ac55422bbb558b346893cf (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.c | 7 |
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) { |