[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: 3c0f6bb751ccd497e2b0028bbde
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: 3c0f6bb751ccd497e2b0028bbde55af91126ec4e |
Date: |
Wed, 16 Oct 2013 17:57:45 +0200 (CEST) |
revision: 3c0f6bb751ccd497e2b0028bbde55af91126ec4e
date: 2013-10-16T07:44:45
author: address@hidden
branch: net.venge.monotone
changelog:
* src/luaext_platform.cc: revert to fclose() rather than pclose() as the
FILE pointers are opened with fdopen(). Correctly initialize a
status variable.
manifest:
format_version "1"
new_manifest [c76350fd668b13a8cd121e4d59f74d5baf4f579b]
old_revision [6af4942ac2764a2339367e95f5a6671a94ecf1b1]
patch "src/luaext_platform.cc"
from [f38fe8fbd69eab71ba2de153c60fd26d53dab96b]
to [7b83e75245cd05bd6947ee3e687247bcf979c5a1]
============================================================
--- src/luaext_platform.cc f38fe8fbd69eab71ba2de153c60fd26d53dab96b
+++ src/luaext_platform.cc 7b83e75245cd05bd6947ee3e687247bcf979c5a1
@@ -116,21 +116,23 @@ typedef struct mtn_lua_Stream {
#define topfile(LS) ((mtn_lua_Stream *)luaL_checkudata(LS, 1, LUA_FILEHANDLE))
-static int io_pclose (lua_State *LS) {
+static int io_fclose (lua_State *LS) {
mtn_lua_Stream *s = topfile(LS);
// Note that in Lua 5.2, aux_close() already resets s->closef to NULL and for
- // Lua 5.1, it's not relevant, at all. But we've set it to &io_pclose(), so
- // contents of s->closef different between Lua versions.
+ // Lua 5.1, it's not relevant, at all. But we set it to &io_fclose() in both
+ // cases, so contents of s->closef differs between Lua versions at this point
+ // in the code. However, it's not used, but only reset to NULL.
- int ok;
+ int ok = 1;
if (s->f != NULL)
- ok = (pclose(s->f) == 0);
+ ok = (fclose(s->f) == 0);
s->f = NULL;
s->closef = NULL; // just to be extra sure this won't do any harm
lua_pushboolean(LS, ok);
+
return 1;
}
@@ -143,7 +145,7 @@ static mtn_lua_Stream *newstream (lua_St
#ifdef LUA_ENVIRONINDEX
// Lua 5.2 removes C function environments
- lua_pushcfunction(LS, io_pclose);
+ lua_pushcfunction(LS, io_fclose);
lua_setfield(LS, LUA_ENVIRONINDEX, "__close");
#endif
@@ -164,10 +166,10 @@ LUAEXT(spawn_pipe, )
argv[i] = NULL;
mtn_lua_Stream *ins = newstream(LS);
- ins->closef = &io_pclose;
+ ins->closef = &io_fclose;
mtn_lua_Stream *outs = newstream(LS);
- outs->closef = &io_pclose;
+ outs->closef = &io_fclose;
pid = process_spawn_pipe(argv, &ins->f, &outs->f);
free(argv);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: 3c0f6bb751ccd497e2b0028bbde55af91126ec4e,
code <=