[yocto] [PATCH][opkg 2/2] conffile: gracefully handle deleted conffiles in conffile_has_been_modified

Ross Burton ross.burton at intel.com
Tue Jan 10 08:02:29 PST 2017


Handle conffiles that don't exist gracefully so that instead of showing an error
message from file_md5sum_alloc() a notice that the file has been deleted is
shown instead.

Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 libopkg/conffile.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libopkg/conffile.c b/libopkg/conffile.c
index b2f2469..7b4b87b 100644
--- a/libopkg/conffile.c
+++ b/libopkg/conffile.c
@@ -51,6 +51,11 @@ int conffile_has_been_modified(conffile_t * conffile)
     }
 
     root_filename = root_filename_alloc(filename);
+    if (!file_exists(root_filename)) {
+        opkg_msg(INFO, "Conffile %s deleted\n", conffile->name);
+        free(root_filename);
+        return 1;
+    }
 
     md5sum = file_md5sum_alloc(root_filename);
 
-- 
2.8.1




More information about the yocto mailing list