internally export x{,un}lock and thus prefix them with _krb5_

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13192 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2003-12-07 18:05:42 +00:00
parent fd226be1f3
commit a561725fdd

View File

@@ -65,8 +65,9 @@ fcc_get_name(krb5_context context,
return FILENAME(id); return FILENAME(id);
} }
static int int
xlock(int fd, krb5_boolean exclusive) _krb5_xlock(krb5_context context, int fd, krb5_boolean exclusive,
const char *filename)
{ {
int ret; int ret;
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
@@ -84,11 +85,17 @@ xlock(int fd, krb5_boolean exclusive)
ret = errno; ret = errno;
if(ret == EACCES) /* fcntl can return EACCES instead of EAGAIN */ if(ret == EACCES) /* fcntl can return EACCES instead of EAGAIN */
ret = EAGAIN; ret = EAGAIN;
if(ret == EAGAIN)
krb5_set_error_string(context, "timed out locking cache file %s",
filename);
else if(ret != 0)
krb5_set_error_string(context, "error locking cache file %s: %s",
filename);
return ret; return ret;
} }
static int int
xunlock(int fd) _krb5_xunlock(int fd)
{ {
#ifdef HAVE_FCNTL_LOCK #ifdef HAVE_FCNTL_LOCK
struct flock l; struct flock l;
@@ -106,21 +113,13 @@ static krb5_error_code
fcc_lock(krb5_context context, krb5_ccache id, fcc_lock(krb5_context context, krb5_ccache id,
int fd, krb5_boolean exclusive) int fd, krb5_boolean exclusive)
{ {
krb5_error_code ret = 0; return _krb5_xlock(context, fd, exclusive, fcc_get_name(context, id));
ret = xlock(fd, exclusive);
if(ret == EAGAIN)
krb5_set_error_string(context, "timed out locking cache file %s",
fcc_get_name(context, id));
else if(ret != 0)
krb5_set_error_string(context, "error locking cache file %s: %s",
fcc_get_name(context, id), strerror(ret));
return ret;
} }
static krb5_error_code static krb5_error_code
fcc_unlock(krb5_context context, int fd) fcc_unlock(krb5_context context, int fd)
{ {
return xunlock(fd); return _krb5_xunlock(fd);
} }
static krb5_error_code static krb5_error_code