aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-10-07 16:18:47 -0700
committerGuy Harris <guy@alum.mit.edu>2014-10-07 23:19:56 +0000
commita566f617d8f712a8f4d1fe7b6d9b9f6ebe79ba11 (patch)
tree1730a9b5c9cc7704273e4104a426e6987f9ef9b6 /epan/wslua/wslua_file.c
parent5e0e4fa9e4de39f9402e6472e6b25439f8464c24 (diff)
No need for WTAP_ERR_CANT_READ.
Unlike the standard I/O routines, the code we introduced that supports fast random seeking on gzipped files will always supply some specific error code for read errors, so we don't need WTAP_ERR_CANT_READ. Add WTAP_ERR_CANT_WRITE for writing, as we're still using the standard I/O routines for that. Set errno to WTAP_ERR_CANT_WRITE before calling fwrite() in wtap_dump_file_write(), so that it's used if fwrite() fails without setting errno. Change-Id: I6bf066a6838284a532737aa65fd0c9bb3639ad63 Reviewed-on: https://code.wireshark.org/review/4540 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/wslua/wslua_file.c')
-rw-r--r--epan/wslua/wslua_file.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/epan/wslua/wslua_file.c b/epan/wslua/wslua_file.c
index 81347aaae0..6e129c9aea 100644
--- a/epan/wslua/wslua_file.c
+++ b/epan/wslua/wslua_file.c
@@ -1668,7 +1668,7 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info)
fp = push_File(L, wth->fh);
fc = push_CaptureInfo(L, wth, TRUE);
- errno = WTAP_ERR_CANT_READ;
+ errno = WTAP_ERR_CANT_OPEN;
switch ( lua_pcall(L,2,1,1) ) {
case 0:
retval = wslua_optboolint(L,-1,0);
@@ -1755,7 +1755,6 @@ wslua_filehandler_read(wtap *wth, int *err, gchar **err_info,
fc = push_CaptureInfo(L, wth, FALSE);
fi = push_FrameInfo(L, &wth->phdr, wth->frame_buffer);
- errno = WTAP_ERR_CANT_READ;
switch ( lua_pcall(L,3,1,1) ) {
case 0:
if (lua_isnumber(L,-1)) {
@@ -1804,7 +1803,6 @@ wslua_filehandler_seek_read(wtap *wth, gint64 seek_off,
fi = push_FrameInfo(L, phdr, buf);
lua_pushnumber(L, (lua_Number)seek_off);
- *err = WTAP_ERR_CANT_READ;
switch ( lua_pcall(L,4,1,1) ) {
case 0:
if (lua_isstring(L,-1)) {
@@ -1916,7 +1914,6 @@ wslua_filehandler_can_write_encap(int encap, void* data)
lua_pushnumber(L, encap);
- errno = WTAP_ERR_CANT_READ;
switch ( lua_pcall(L,1,1,1) ) {
case 0:
retval = wslua_optboolint(L,-1,WTAP_ERR_UNSUPPORTED_ENCAP);
@@ -2027,7 +2024,7 @@ wslua_filehandler_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
fc = push_CaptureInfoConst(L,wdh);
fi = push_FrameInfoConst(L, phdr, pd);
- errno = WTAP_ERR_CANT_READ;
+ errno = WTAP_ERR_CANT_WRITE;
switch ( lua_pcall(L,3,1,1) ) {
case 0:
retval = wslua_optboolint(L,-1,0);
@@ -2064,7 +2061,7 @@ wslua_filehandler_dump_close(wtap_dumper *wdh, int *err)
fp = push_Wdh(L, wdh);
fc = push_CaptureInfoConst(L,wdh);
- errno = WTAP_ERR_CANT_READ;
+ errno = WTAP_ERR_CANT_CLOSE;
switch ( lua_pcall(L,2,1,1) ) {
case 0:
retval = wslua_optboolint(L,-1,0);