HAMMER - Check if supplied conf file exists
authorStathis Kamperis <beket@dragonflybsd.org>
Sat, 13 Nov 2010 16:40:48 +0000 (18:40 +0200)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 18 Nov 2010 17:44:29 +0000 (09:44 -0800)
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1911>

sbin/hammer/cmd_config.c

index 5e68e60..fe5c87c 100644 (file)
@@ -87,6 +87,10 @@ hammer_cmd_config(char **av, int ac)
        config.head.error = 0;
 
        fd = open(av[1], O_RDONLY);
+       if (fd < 0) {
+               err(2, "hammer config: %s", av[1]);
+               /* not reached */
+       }
        n = read(fd, config.config.text, sizeof(config.config.text) - 1);
        if (n == sizeof(config.config.text) - 1) {
                err(2, "hammer config: config file too big, limit %zu bytes",