Avoid some warn_unused_result warning
authorpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Tue, 17 Nov 2009 11:17:42 +0000 (11:17 +0000)
committerpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Tue, 17 Nov 2009 11:17:42 +0000 (11:17 +0000)
lockf maybe defined with warn_unused_result. Check the return
value to disable the warning (And add an error message by the way)

git-svn-id: http://opkg.googlecode.com/svn/trunk@330 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/opkg_conf.c

index cade51a487f1de76783b1b4f27f46aba25c7f0e1..c69c3d1c91c107086d70488e8e020810c2864cb9 100644 (file)
@@ -415,7 +415,12 @@ void opkg_conf_deinit(opkg_conf_t *conf)
      if (&conf->obs_file_hash)
                    hash_table_deinit(&conf->obs_file_hash);
 
-     lockf(conf->lock_fd, F_ULOCK, 0);
+     /* lockf maybe defined with warn_unused_result */
+     if(lockf(conf->lock_fd, F_ULOCK, 0) != 0){
+              opkg_message(conf, OPKG_DEBUG, "%s: unlock failed: %s\n",
+                              __FUNCTION__, 
+                              strerror(errno));
+     }
      close(conf->lock_fd);
 }