summaryrefslogtreecommitdiff
path: root/usr.bin/mixerctl/mixerctl.c
diff options
context:
space:
mode:
authorVincent Labrecque <vincent@cvs.openbsd.org>2004-01-22 17:44:55 +0000
committerVincent Labrecque <vincent@cvs.openbsd.org>2004-01-22 17:44:55 +0000
commit659866913424727b3d2dab5ee0dba8d63c218186 (patch)
tree8d9e847bc24cbd399b717be5193541aebf98ba47 /usr.bin/mixerctl/mixerctl.c
parentd932f6f7369ef70c3d84323f8c028d1dc00a39c9 (diff)
fix segfault when an invalid field was requested
ok miod
Diffstat (limited to 'usr.bin/mixerctl/mixerctl.c')
-rw-r--r--usr.bin/mixerctl/mixerctl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/mixerctl/mixerctl.c b/usr.bin/mixerctl/mixerctl.c
index ba0d1db4bf5..db856853beb 100644
--- a/usr.bin/mixerctl/mixerctl.c
+++ b/usr.bin/mixerctl/mixerctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mixerctl.c,v 1.14 2004/01/22 08:06:18 tedu Exp $ */
+/* $OpenBSD: mixerctl.c,v 1.15 2004/01/22 17:44:54 vincent Exp $ */
/* $NetBSD: mixerctl.c,v 1.11 1998/04/27 16:55:23 augustss Exp $ */
/*
@@ -372,11 +372,15 @@ main(int argc, char **argv)
}
}
}
- argv++;
+ argv++;
} else {
p = findfield(*argv);
- prfield(p, sep, vflag);
- fprintf(out, "\n");
+ if (p == NULL)
+ warnx("field %s does not exist", *argv);
+ else {
+ prfield(p, sep, vflag);
+ fprintf(out, "\n");
+ }
}
}
} else