summaryrefslogtreecommitdiff
path: root/missing
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-04-16 06:54:40 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-04-16 06:54:40 +0000
commitac34c44470406442e9912611858de77b43800a8b (patch)
tree058d1ce66cde9c9141389b312db815c8f748d8b3 /missing
parent4c61680885299984b5b1a51845766c4f6ca39c3b (diff)
* regex.c (calculate_must_string): wrong length calculation.
* eval.c (rb_thread_start_0): fixed memory leak. * parse.y (none): should clear cmdarg_stack too. * io.c (rb_fopen): use setvbuf() to avoid recursive malloc() on some platforms. * file.c (rb_stat_dev): device functions should honor stat field types (except long long such as dev_t). * eval.c (rb_mod_nesting): should not push nil for nesting array. * eval.c (rb_mod_s_constants): should not search array by rb_mod_const_at() for nil (happens for singleton class). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing')
-rw-r--r--missing/flock.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/missing/flock.c b/missing/flock.c
index e293ca0d72..c828fcc7ad 100644
--- a/missing/flock.c
+++ b/missing/flock.c
@@ -94,7 +94,6 @@ flock(fd, operation)
int fd;
int operation;
{
- int i;
switch (operation) {
/* LOCK_SH - get a shared lock */
@@ -103,8 +102,7 @@ flock(fd, operation)
return -1;
/* LOCK_EX - get an exclusive lock */
case LOCK_EX:
- i = lockf (fd, F_LOCK, 0);
- break;
+ return lockf (fd, F_LOCK, 0);
/* LOCK_SH|LOCK_NB - get a non-blocking shared lock */
case LOCK_SH|LOCK_NB:
@@ -112,24 +110,17 @@ flock(fd, operation)
return -1;
/* LOCK_EX|LOCK_NB - get a non-blocking exclusive lock */
case LOCK_EX|LOCK_NB:
- i = lockf (fd, F_TLOCK, 0);
- if (i == -1)
- if ((errno == EAGAIN) || (errno == EACCES))
- errno = EWOULDBLOCK;
- break;
+ return lockf (fd, F_TLOCK, 0);
/* LOCK_UN - unlock */
case LOCK_UN:
- i = lockf (fd, F_ULOCK, 0);
- break;
+ return lockf (fd, F_ULOCK, 0);
/* Default - can't decipher operation */
default:
- i = -1;
errno = EINVAL;
- break;
+ return -1;
}
- return i;
}
#elif !defined NT
int