From 1f1a165ea9104891eb51f84ab07dc4977938024b Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Tue, 8 Feb 2011 12:03:08 +0100 Subject: [PATCH] s3:net idmap restore: fix segfault on missing input file --- source3/utils/net_idmap.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; }