pkg just says "Could not obtain administrative lock" and provides no
further info when it encounters problems with the lock file. The
attached
patch makes these errors a bit easier to diagnose.
Thanks to cconroy
http://code.google.com/p/opkg/issues/detail?id=22
git-svn-id: http://opkg.googlecode.com/svn/trunk@216
e8e0d7a0-c8d9-11dd-a880-
a1081c7ac358
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
extern char *conf_file_dir;
extern char *conf_file_dir;
int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
{
int err;
int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
{
int err;
char *tmp_dir_base;
nv_pair_list_t tmp_dest_nv_pair_list;
char *lists_dir = NULL, *lock_file = NULL;
char *tmp_dir_base;
nv_pair_list_t tmp_dest_nv_pair_list;
char *lists_dir = NULL, *lock_file = NULL;
conf->lock_fd = creat (lock_file, S_IRUSR | S_IWUSR | S_IRGRP);
err = lockf (conf->lock_fd, F_TLOCK, 0);
conf->lock_fd = creat (lock_file, S_IRUSR | S_IWUSR | S_IRGRP);
err = lockf (conf->lock_fd, F_TLOCK, 0);
free (lock_file);
if (err)
{
free (lock_file);
if (err)
{
- opkg_message (conf, OPKG_ERROR, "Could not obtain administrative lock\n");
+ if(args->offline_root) {
+ opkg_message (conf, OPKG_ERROR, "Could not obtain administrative lock for offline root (ERR: %s) at %s/%s/lock\n",
+ strerror(errno_copy), args->offline_root, OPKG_STATE_DIR_PREFIX);
+ } else {
+ opkg_message (conf, OPKG_ERROR, "Could not obtain administrative lock (ERR: %s) at %s/lock\n",
+ strerror(errno_copy), OPKG_STATE_DIR_PREFIX);
+ }
return OPKG_CONF_ERR_LOCK;
}
return OPKG_CONF_ERR_LOCK;
}