Reply.c patch [ disk quotas ]
Luis Claudio R. Goncalves
nescau at akira.ucpel.tche.br
Thu Feb 25 13:44:25 GMT 1999
Hi!
Following this message there's a little patch that "corrects" a weird
behavior (or feature) of reply.c - at least in Linux and Solaris boxes.
If you're writing a file in the disk and you reach the quota roof, the
file will be truncated and zero filled 'till its nominal size - it isn't
a Samba problem, it's a filesystem feature but when it begins to create
corrupted files it's time to stop. This simple and ugly patch corrects
the truncated file size every time the above scene happens to any user.
Hope this helps.
Luis Claudio
PS: I did this patch in Samba 2.0.2
[ Luis Claudio R. Goncalves nescau at akira.ucpel.tche.br ]
[ BSc in Computer Science -- Gospel User -- NetAdmin -- Linuxer -- Musician? ]
[ RHuser - DRWATSON.EXE user - http://akira.ucpel.tche.br/~nescau - IS 40:31 ]
[______________________________ Yeshua Hamashia _____________________________]
# -----------------cut here--------------------
--- smbd/reply.c.orig Thu Feb 25 16:22:59 1999
+++ smbd/reply.c Thu Feb 25 16:24:56 1999
@@ -2399,14 +2399,21 @@
if (lp_syncalways(SNUM(conn)))
sync_file(conn,fsp);
- if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0))
+ if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) {
+ nwritten = set_filelen(fsp->fd_ptr->fd, (SMB_OFF_T)startpos);
+ DEBUG(0,("REPLY.C: File [%s] truncated to %d bytes\n",
+ fsp->fsp_name, (SMB_OFF_T)startpos));
return(UNIXERROR(ERRDOS,ERRnoaccess));
+ }
outsize = set_message(outbuf,1,0,True);
SSVAL(outbuf,smb_vwv0,nwritten);
if (nwritten < (ssize_t)numtowrite) {
+ nwritten = set_filelen(fsp->fd_ptr->fd, (SMB_OFF_T)startpos + nwritten);
+ DEBUG(0,("REPLY.C: File [%s] truncated to %d bytes\n",
+ fsp->fsp_name, (SMB_OFF_T)startpos));
CVAL(outbuf,smb_rcls) = ERRHRD;
SSVAL(outbuf,smb_err,ERRdiskfull);
}
More information about the samba-ntdom
mailing list