Commit ecce2a8a authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Detect smb_fallocdat() and ftell() failures

CID 33245
parent 92cb6318
......@@ -1196,16 +1196,26 @@ void packmsgs(ulong packable)
continue;
}
off_t offset;
if(!(smb.status.attr&SMB_HYPERALLOC)) {
msg.hdr.offset = (uint32_t)smb_fallocdat(&smb,(uint32_t)m,1);
datoffset[datoffsets].new = msg.hdr.offset;
offset = smb_fallocdat(&smb,(uint32_t)m,1);
if(offset < 0) {
fprintf(errfp,"\n%s!Data allocation failure: %ld\n", beep, (long)offset);
continue;
}
datoffset[datoffsets].new = (uint32_t)offset;
datoffsets++;
fseek(tmp_sdt,msg.hdr.offset,SEEK_SET);
fseeko(tmp_sdt, offset, SEEK_SET);
}
else {
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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment