summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2016-05-28 16:00:20 +0000
committerBob Beck <beck@cvs.openbsd.org>2016-05-28 16:00:20 +0000
commit4447e275267f931372259ca6bdd2ba8bac431d55 (patch)
treed5d1a982d07fa7a62a88ba02fa91fd6eafdda8bc /sbin
parent90b0e4be9c57805fcf06de09a24eddd594fdf8c6 (diff)
fix crash if filename not provided
Diffstat (limited to 'sbin')
-rw-r--r--sbin/disklabel/disklabel.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index ab32f047e35..be0b76f59a1 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.215 2016/05/28 15:46:43 beck Exp $ */
+/* $OpenBSD: disklabel.c,v 1.216 2016/05/28 16:00:19 beck Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -191,6 +191,8 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ if (argv[0] == NULL)
+ usage();
dkname = argv[0];
f = opendev(dkname, (op == READ ? O_RDONLY : O_RDWR), OPENDEV_PART,
&specname);