From: Gregor Beck Date: Tue, 8 Feb 2011 11:03:08 +0000 (+0100) Subject: s3:net idmap restore: fix segfault on missing input file X-Git-Tag: tevent-0.9.11~846 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1f1a165ea9104891eb51f84ab07dc4977938024b;p=thirdparty%2Fsamba.git s3:net idmap restore: fix segfault on missing input file --- diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c index 7551354cef0..3f9fa800592 100644 --- a/source3/utils/net_idmap.c +++ b/source3/utils/net_idmap.c @@ -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; }