From: Nguyễn Thái Ngọc Duy Date: Fri, 03 Mar 2017 09:42:51 GMT Subject: [PATCH 1/2] config: check if config path is a file before parsing it Message-ID: <20170303094252.11706-2-pclouds@gmail.com> In-Reply-To: <20170303094252.11706-1-pclouds@gmail.com> If a directory is given as a config file by accident, we keep open it as a file. The behavior of fopen() in this case seems to be undefined. On Linux, we open a directory as a file ok, then get error (which we consider eof) on the first read. So the config parser sees this "file" as empty (i.e. valid config). All is well and we don't complain anything (but we should). The situation is slighly different on Windows. I think fopen() returns NULL. And we get a very unhelpful message: $ cat >abc <