summaryrefslogtreecommitdiff
path: root/source3/lib/util_file.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-07-15 10:35:28 +0000
committerAndrew Tridgell <tridge@samba.org>2002-07-15 10:35:28 +0000
commite90b65284812aaa5ff9e9935ce9bbad7791cbbcd (patch)
tree9e744d1dc2f93934a4b49166a37383d3cb2b2139 /source3/lib/util_file.c
parentec167dc9cc0ec2ee461837c25a371d2981744208 (diff)
downloadsamba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.gz
samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.bz2
samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.zip
updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
Diffstat (limited to 'source3/lib/util_file.c')
-rw-r--r--source3/lib/util_file.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index e80267f84b..611e0e40be 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -40,9 +40,10 @@ BOOL do_file_lock(int fd, int waitsecs, int type)
{
SMB_STRUCT_FLOCK lock;
int ret;
+ void (*oldsig_handler)(int);
gotalarm = 0;
- CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
+ oldsig_handler = CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
lock.l_type = type;
lock.l_whence = SEEK_SET;
@@ -51,9 +52,10 @@ BOOL do_file_lock(int fd, int waitsecs, int type)
lock.l_pid = 0;
alarm(waitsecs);
+ /* Note we must *NOT* use sys_fcntl here ! JRA */
ret = fcntl(fd, SMB_F_SETLKW, &lock);
alarm(0);
- CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN);
+ CatchSignal(SIGALRM, SIGNAL_CAST oldsig_handler);
if (gotalarm) {
DEBUG(0, ("do_file_lock: failed to %s file.\n",
@@ -448,7 +450,8 @@ void *map_file(char *fname, size_t size)
#endif
if (!p) {
p = file_load(fname, &s2);
- if (!p || s2 != size) {
+ if (!p) return NULL;
+ if (s2 != size) {
DEBUG(1,("incorrect size for %s - got %d expected %d\n",
fname, s2, size));
if (p) free(p);