[syslinux:master] advio: make read_adv() distinguish ENOENT from other errors

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Thu Jun 24 13:12:34 PDT 2010


Commit-ID:  d52b620e4f296cd1cb48afdcead64fc1b040e0dc
Gitweb:     http://syslinux.zytor.com/commit/d52b620e4f296cd1cb48afdcead64fc1b040e0dc
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Thu, 24 Jun 2010 13:03:35 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Thu, 24 Jun 2010 13:03:35 -0700

advio: make read_adv() distinguish ENOENT from other errors

Make it possible to distinguish ENOENT from other "non-fatal" errors
in read_adv(), so we can try more than one filename.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>


---
 libinstaller/advio.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libinstaller/advio.c b/libinstaller/advio.c
index 3112fa4..7bfc098 100644
--- a/libinstaller/advio.c
+++ b/libinstaller/advio.c
@@ -36,8 +36,8 @@
 
 /*
  * Read the ADV from an existing instance, or initialize if invalid.
- * Returns -1 on fatal errors, 0 if ADV is okay, and 1 if no valid
- * ADV was found.
+ * Returns -1 on fatal errors, 0 if ADV is okay, 1 if the ADV is
+ * invalid, and 2 if the file does not exist.
  */
 int read_adv(const char *path, const char *cfg)
 {
@@ -60,6 +60,7 @@ int read_adv(const char *path, const char *cfg)
 	    err = -1;
 	} else {
 	    syslinux_reset_adv(syslinux_adv);
+	    err = 2;		/* Nonexistence is not a fatal error */
 	}
     } else if (fstat(fd, &st)) {
 	err = -1;



More information about the Syslinux-commits mailing list