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

Detect smb_fallocdat() and ftell() failures

CID 33245
parent 92cb6318
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -1196,16 +1196,26 @@ void packmsgs(ulong packable) ...@@ -1196,16 +1196,26 @@ void packmsgs(ulong packable)
continue; continue;
} }
off_t offset;
if(!(smb.status.attr&SMB_HYPERALLOC)) { if(!(smb.status.attr&SMB_HYPERALLOC)) {
msg.hdr.offset = (uint32_t)smb_fallocdat(&smb,(uint32_t)m,1); offset = smb_fallocdat(&smb,(uint32_t)m,1);
datoffset[datoffsets].new = msg.hdr.offset; if(offset < 0) {
fprintf(errfp,"\n%s!Data allocation failure: %ld\n", beep, (long)offset);
continue;
}
datoffset[datoffsets].new = (uint32_t)offset;
datoffsets++; datoffsets++;
fseek(tmp_sdt,msg.hdr.offset,SEEK_SET); fseeko(tmp_sdt, offset, SEEK_SET);
} }
else { else {
fseek(tmp_sdt,0L,SEEK_END); fseek(tmp_sdt,0L,SEEK_END);
msg.hdr.offset=ftell(tmp_sdt); offset=ftell(tmp_sdt);
if(offset < 0) {
fprintf(errfp,"\n%s!ftell() ERROR %d\n", beep, errno);
continue;
}
} }
msg.hdr.offset = (uint32_t)offset;
/* Actually copy the data */ /* Actually copy the data */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment