From 437bc39bdbffb4ae309c21cf667c780b80317d6b Mon Sep 17 00:00:00 2001 From: Chris Provenzano Date: Wed, 16 Aug 1995 07:30:49 +0000 Subject: [PATCH] Pass the fd in instead of converting it from FILE * git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6538 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/ChangeLog | 5 +++++ src/lib/krb5/os/lock_file.c | 14 ++++++-------- src/lib/krb5/os/unlck_file.c | 7 +++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 5f39e02cc..d37a91016 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,8 @@ +Wed Aug 16 02:45:19 1995 Chris Provenzano + + * lock_file.c (krb5_lock_file()), unlck_file.c (krb5_unlock_file()): + Pass the fd in instead of converting it from FILE *. + Fri Aug 4 22:51:15 1995 Tom Yu * kuserok.c (krb5_kuserok): Add parens to shut up gcc -Wall diff --git a/src/lib/krb5/os/lock_file.c b/src/lib/krb5/os/lock_file.c index dfdd729ed..5571521b9 100644 --- a/src/lib/krb5/os/lock_file.c +++ b/src/lib/krb5/os/lock_file.c @@ -52,10 +52,9 @@ extern int errno; /*ARGSUSED*/ krb5_error_code -krb5_lock_file(context, filep, pathname, mode) +krb5_lock_file(context, fd, mode) krb5_context context; - FILE *filep; - char *pathname; + int fd; int mode; { #ifdef POSIX_FILE_LOCKS @@ -94,14 +93,14 @@ krb5_lock_file(context, filep, pathname, mode) lock_arg.l_whence = 0; lock_arg.l_start = 0; lock_arg.l_len = 0; - if (fcntl(fileno(filep), lock_cmd, &lock_arg) == -1) { + if (fcntl(fd, lock_cmd, &lock_arg) == -1) { if (errno == EACCES || errno == EAGAIN) /* see POSIX/IEEE 1003.1-1988, 6.5.2.4 */ return(EAGAIN); return(errno); } #else - if (flock(fileno(filep), lock_flag) == -1) + if (flock(fd, lock_flag) == -1) return(errno); #endif return 0; @@ -109,10 +108,9 @@ krb5_lock_file(context, filep, pathname, mode) #else /* MSDOS or Macintosh */ krb5_error_code -krb5_lock_file(context, filep, pathname, mode) +krb5_lock_file(context, fd, mode) krb5_context context; - FILE *filep; - char *pathname; + int fd; int mode; { return 0; diff --git a/src/lib/krb5/os/unlck_file.c b/src/lib/krb5/os/unlck_file.c index 44f90e6af..bea19c123 100644 --- a/src/lib/krb5/os/unlck_file.c +++ b/src/lib/krb5/os/unlck_file.c @@ -28,10 +28,9 @@ #include krb5_error_code -krb5_unlock_file(context, filep, pathname) +krb5_unlock_file(context, fd) krb5_context context; - FILE *filep; - char *pathname; + int fd; { - return krb5_lock_file(context, filep, pathname, KRB5_LOCKMODE_UNLOCK); + return krb5_lock_file(context, fd, KRB5_LOCKMODE_UNLOCK); } -- 2.26.2