From d52b620e4f296cd1cb48afdcead64fc1b040e0dc Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 24 Jun 2010 13:03:35 -0700 Subject: [PATCH] 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 --- libinstaller/advio.c | 5 +++-- 1 file 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; -- 2.7.4