projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c005fe2
)
util.pposix: Fix error reporting from really old Linux fallocate() that did not use...
author
Kim Alvefur
<zash@zash.se>
Fri, 25 Apr 2014 00:41:55 +0000
(
02:41
+0200)
committer
Kim Alvefur
<zash@zash.se>
Fri, 25 Apr 2014 00:41:55 +0000
(
02:41
+0200)
util-src/pposix.c
patch
|
blob
|
history
diff --git
a/util-src/pposix.c
b/util-src/pposix.c
index a8654995a5daa147049ac782b49776e6167afaa4..df814c2899fc98d90ccfed116cd1ada3cd3a2d1d 100644
(file)
--- a/
util-src/pposix.c
+++ b/
util-src/pposix.c
@@
-674,11
+674,15
@@
int lc_fallocate(lua_State* L)
len = luaL_checkinteger(L, 3);
#if defined(__linux__) && defined(_GNU_SOURCE)
len = luaL_checkinteger(L, 3);
#if defined(__linux__) && defined(_GNU_SOURCE)
- if(fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len) == 0)
+ errno = 0;
+ ret = fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len);
+ if(ret == 0)
{
lua_pushboolean(L, 1);
return 1;
}
{
lua_pushboolean(L, 1);
return 1;
}
+ /* Some old versions of Linux apparently use the return value instead of errno */
+ if(errno == 0) errno = ret;
if(errno != ENOSYS && errno != EOPNOTSUPP)
{
if(errno != ENOSYS && errno != EOPNOTSUPP)
{