From: graham.gower Date: Thu, 12 Nov 2009 06:26:11 +0000 (+0000) Subject: Don't clobber errno, so that we can provide a useful error message. X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=377c695695365f89f0a47507d17562be67d8ca04;p=oweals%2Fopkg-lede.git 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 --- 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);