Fix SEGV in lseek
I found hard way why the code was using "_whence" name.
* file.c: Rename whence[] to whence_codes[].
(sys_lseek): Fix printxval() to use whence_codes[].
(sys_lseek32): Likewise.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/file.c b/file.c
index c3a826b..3a98674 100644
--- a/file.c
+++ b/file.c
@@ -516,7 +516,7 @@
return RVAL_OCTAL;
}
-static const struct xlat whence[] = {
+static const struct xlat whence_codes[] = {
{ SEEK_SET, "SEEK_SET" },
{ SEEK_CUR, "SEEK_CUR" },
{ SEEK_END, "SEEK_END" },
@@ -544,7 +544,7 @@
tprintf(", %llu, ", offset);
else
tprintf(", %lld, ", offset);
- printxval(whence, whence, "SEEK_???");
+ printxval(whence_codes, whence, "SEEK_???");
}
return RVAL_LUDECIMAL;
}
@@ -564,7 +564,7 @@
tprintf(", %lu, ", offset);
else
tprintf(", %ld, ", offset);
- printxval(whence, whence, "SEEK_???");
+ printxval(whence_codes, whence, "SEEK_???");
}
return RVAL_UDECIMAL;
}
@@ -584,7 +584,7 @@
tprintf(", %lu, ", offset);
else
tprintf(", %ld, ", offset);
- printxval(whence, whence, "SEEK_???");
+ printxval(whence_codes, whence, "SEEK_???");
}
return RVAL_UDECIMAL;
}
@@ -622,7 +622,7 @@
tprintf("%#lx, ", tcp->u_arg[3]);
else
tprintf("[%llu], ", off);
- printxval(whence, tcp->u_arg[4], "SEEK_???");
+ printxval(whence_codes, tcp->u_arg[4], "SEEK_???");
}
return 0;
}