summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-12 01:26:11 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-12 01:26:11 (EST)
commit377c695695365f89f0a47507d17562be67d8ca04 (patch)
tree8477d18ee9e48e406c822623a961f56bd9c5fada
parent7be28022d09b3a4923db82bae66187ceafa5a53c (diff)
Don't clobber errno, so that we can provide a useful error message.
git-svn-id: http://opkg.googlecode.com/svn/trunk@288 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/opkg_conf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 4b2ad03..f67711e 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -152,8 +152,9 @@ int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
else
sprintf_alloc (&lock_file, "%s/lock", OPKG_STATE_DIR_PREFIX);
- conf->lock_fd = creat (lock_file, S_IRUSR | S_IWUSR | S_IRGRP);
- err = lockf (conf->lock_fd, F_TLOCK, 0);
+ err = conf->lock_fd = creat (lock_file, S_IRUSR | S_IWUSR | S_IRGRP);
+ if (err != -1)
+ err = lockf (conf->lock_fd, F_TLOCK, 0);
errno_copy = errno;
free (lock_file);