Skip to content
Snippets Groups Projects
Commit f532bee9 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix bug with FileBase.get_time() for filenames > 64 chars in length

We need to read the file header (not just index) entry to get the actual
full filename.

Also, removed some extraneous calls to getfilepath() that served no
purposed.
parent 89dda20e
Branches
Tags
1 merge request!455Update branch with changes from master
...@@ -1092,8 +1092,6 @@ js_get_file_size(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1092,8 +1092,6 @@ js_get_file_size(JSContext *cx, uintN argc, jsval *arglist)
rc=JS_SUSPENDREQUEST(cx); rc=JS_SUSPENDREQUEST(cx);
if((p->smb_result = smb_loadfile(&p->smb, filename, &file, file_detail_normal)) == SMB_SUCCESS) { if((p->smb_result = smb_loadfile(&p->smb, filename, &file, file_detail_normal)) == SMB_SUCCESS) {
char path[MAX_PATH + 1];
getfilepath(scfg, &file, path);
JS_SET_RVAL(cx, arglist, DOUBLE_TO_JSVAL((jsdouble)getfilesize(scfg, &file))); JS_SET_RVAL(cx, arglist, DOUBLE_TO_JSVAL((jsdouble)getfilesize(scfg, &file)));
smb_freefilemem(&file); smb_freefilemem(&file);
} }
...@@ -1141,9 +1139,7 @@ js_get_file_time(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1141,9 +1139,7 @@ js_get_file_time(JSContext *cx, uintN argc, jsval *arglist)
return JS_TRUE; return JS_TRUE;
rc=JS_SUSPENDREQUEST(cx); rc=JS_SUSPENDREQUEST(cx);
if((p->smb_result = smb_loadfile(&p->smb, filename, &file, file_detail_index)) == SMB_SUCCESS) { if((p->smb_result = smb_loadfile(&p->smb, filename, &file, file_detail_normal)) == SMB_SUCCESS) {
char path[MAX_PATH + 1];
getfilepath(scfg, &file, path);
JS_SET_RVAL(cx, arglist, UINT_TO_JSVAL((uint32)getfiletime(scfg, &file))); JS_SET_RVAL(cx, arglist, UINT_TO_JSVAL((uint32)getfiletime(scfg, &file)));
smb_freefilemem(&file); smb_freefilemem(&file);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment