s3:net idmap restore: fix segfault on missing input file
authorGregor Beck <gbeck@sernet.de>
Tue, 8 Feb 2011 11:03:08 +0000 (12:03 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 9 Feb 2011 13:00:34 +0000 (14:00 +0100)
source3/utils/net_idmap.c

index 7551354cef0c719b67b8f5c1446f5ac2cb736c3d..3f9fa80059222507d14f04ff1bce61b8524f1a50 100644 (file)
@@ -190,6 +190,12 @@ static int net_idmap_restore(struct net_context *c, int argc, const char **argv)
 
        if (argc == 1) {
                input = fopen(argv[0], "r");
+               if (input == NULL) {
+                       d_fprintf(stderr, _("Could not open input file (%s): %s\n"),
+                                 argv[0], strerror(errno));
+                       ret = -1;
+                       goto done;
+               }
        } else {
                input = stdin;
        }