From: Benno Schulenberg Date: Fri, 15 Jan 2016 14:23:50 +0000 (+0000) Subject: Returning a fantastic file descriptor -- when opening X-Git-Tag: v2.5.2~70 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=caa759be31c5a979f8a4bad0f0cccadab3ceb608;p=nano.git Returning a fantastic file descriptor -- when opening a non-existent file for reading succeeds. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5565 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 006b5c28..0d32c040 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2016-01-15 Benno Schulenberg * src/winio.c (set_modified): Plug another memory leak. + * src/files.c (open_file): Return the fantastic file descriptor + when opening a non-existent file for reading succeeds. 2016-01-15 Mike Frysinger * src/files.c (open_file): Free the full filename in all cases. diff --git a/src/files.c b/src/files.c index ab0b2ccc..1b89c0e9 100644 --- a/src/files.c +++ b/src/files.c @@ -933,7 +933,7 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f) if ((fd = open(filename, O_RDONLY)) != -1) { if (!quiet) statusbar(_("Reading File")); - return 0; + return fd; } if (newfie) {