version 1.1.1.1, 1999/11/18 16:29:01 |
version 1.1.1.1.6.1, 2002/01/18 17:20:23 |
|
|
/* |
/* |
* Copyright (c) 1999 Todd C. Miller <Todd.Miller@courtesan.com> |
* Copyright (c) 1999, 2001 Todd C. Miller <Todd.Miller@courtesan.com> |
* All rights reserved. |
* All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
|
|
|
|
#include "config.h" |
#include "config.h" |
|
|
|
#include <sys/types.h> |
|
#include <sys/param.h> |
|
#ifdef HAVE_FLOCK |
|
# include <sys/file.h> |
|
#endif /* HAVE_FLOCK */ |
#include <stdio.h> |
#include <stdio.h> |
#ifdef HAVE_UNISTD_H |
#ifdef HAVE_UNISTD_H |
#include <unistd.h> |
# include <unistd.h> |
#endif /* HAVE_UNISTD_H */ |
#endif /* HAVE_UNISTD_H */ |
#include <fcntl.h> |
#include <fcntl.h> |
#include <time.h> |
#include <time.h> |
#include <sys/types.h> |
|
#include <sys/param.h> |
|
#ifdef HAVE_UTIME |
#ifdef HAVE_UTIME |
# ifdef HAVE_UTIME_H |
# ifdef HAVE_UTIME_H |
# include <utime.h> |
# include <utime.h> |
# endif /* HAVE_UTIME_H */ |
# endif /* HAVE_UTIME_H */ |
#else |
#else |
# include "emul/utime.h" |
# include "emul/utime.h" |
#endif /* HAVE_UTIME */ |
#endif /* HAVE_UTIME */ |
|
|
#include "sudo.h" |
#include "sudo.h" |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: fileops.c,v 1.1 1999/08/07 09:59:43 millert Exp $"; |
static const char rcsid[] = "$Sudo: fileops.c,v 1.3 2001/12/14 19:52:47 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
op = LOCK_EX | LOCK_NB; |
op = LOCK_EX | LOCK_NB; |
break; |
break; |
case SUDO_UNLOCK: |
case SUDO_UNLOCK: |
op = LOCK_EX; |
op = LOCK_UN; |
break; |
break; |
} |
} |
return(flock(fd, op) == 0); |
return(flock(fd, op) == 0); |