summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-02-10 14:11:28 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-02-11 12:32:24 +0200
commitd0595eaa8ad8a9155a0fa4b0b6f4b3d5ed08b2e8 (patch)
tree03b057643d43fab133e007755a797de109d92731 /lib
parent67d6e7549720551f4750ac303c50e6c7e6ca00f5 (diff)
downloadlibrpm-tizen-d0595eaa8ad8a9155a0fa4b0b6f4b3d5ed08b2e8.tar.gz
librpm-tizen-d0595eaa8ad8a9155a0fa4b0b6f4b3d5ed08b2e8.tar.bz2
librpm-tizen-d0595eaa8ad8a9155a0fa4b0b6f4b3d5ed08b2e8.zip
Be more careful about errors in lua rpm vercmp()
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmliblua.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/rpmliblua.c b/lib/rpmliblua.c
index 6876d2fb9..046ed3180 100644
--- a/lib/rpmliblua.c
+++ b/lib/rpmliblua.c
@@ -12,14 +12,15 @@
static int rpm_vercmp(lua_State *L)
{
const char *v1, *v2;
- int rc;
+ int rc = 0;
v1 = luaL_checkstring(L, 1);
v2 = luaL_checkstring(L, 2);
-
- rc = rpmvercmp(v1, v2);
- lua_pushinteger(L, rc);
- return 1;
+ if (v1 && v2) {
+ lua_pushinteger(L, rpmvercmp(v1, v2));
+ rc = 1;
+ }
+ return rc;
}
static const luaL_reg luarpmlib_f[] = {