1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r5822: Actually return an error message if disk_free fails ! Pointed out by Ying Li <ying.li2@hp.com>.

Jeremy.
(This used to be commit b5d31b2caf)
This commit is contained in:
Jeremy Allison 2005-03-16 01:41:21 +00:00 committed by Gerald (Jerry) Carter
parent 99db77b2b2
commit 7dcbde86ae
3 changed files with 26 additions and 7 deletions

View File

@ -115,10 +115,19 @@ static SMB_BIG_UINT disk_free(const char *path, BOOL small_query,
} else {
DEBUG (0, ("disk_free: sys_popen() failed for command %s. Error was : %s\n",
syscmd, strerror(errno) ));
sys_fsusage(path, dfree, dsize);
if (sys_fsusage(path, dfree, dsize) != 0) {
DEBUG (0, ("disk_free: sys_fsusage() failed. Error was : %s\n",
strerror(errno) ));
return (SMB_BIG_UINT)-1;
}
}
} else
sys_fsusage(path, dfree, dsize);
} else {
if (sys_fsusage(path, dfree, dsize) != 0) {
DEBUG (0, ("disk_free: sys_fsusage() failed. Error was : %s\n",
strerror(errno) ));
return (SMB_BIG_UINT)-1;
}
}
if (disk_quotas(path, &bsize_q, &dfree_q, &dsize_q)) {
(*bsize) = bsize_q;

View File

@ -751,7 +751,10 @@ int reply_dskattr(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz
SMB_BIG_UINT dfree,dsize,bsize;
START_PROFILE(SMBdskattr);
SMB_VFS_DISK_FREE(conn,".",True,&bsize,&dfree,&dsize);
if (SMB_VFS_DISK_FREE(conn,".",True,&bsize,&dfree,&dsize) == (SMB_BIG_UINT)-1) {
END_PROFILE(SMBdskattr);
return(UNIXERROR(ERRHRD,ERRgeneral));
}
outsize = set_message(outbuf,5,0,True);

View File

@ -1785,7 +1785,10 @@ static int call_trans2qfsinfo(connection_struct *conn, char *inbuf, char *outbuf
{
SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
data_len = 18;
SMB_VFS_DISK_FREE(conn,".",False,&bsize,&dfree,&dsize);
if (SMB_VFS_DISK_FREE(conn,".",False,&bsize,&dfree,&dsize) == (SMB_BIG_UINT)-1) {
return(UNIXERROR(ERRHRD,ERRgeneral));
}
block_size = lp_block_size(snum);
if (bsize < block_size) {
SMB_BIG_UINT factor = block_size/bsize;
@ -1877,7 +1880,9 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi
{
SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
data_len = 24;
SMB_VFS_DISK_FREE(conn,".",False,&bsize,&dfree,&dsize);
if (SMB_VFS_DISK_FREE(conn,".",False,&bsize,&dfree,&dsize) == (SMB_BIG_UINT)-1) {
return(UNIXERROR(ERRHRD,ERRgeneral));
}
block_size = lp_block_size(snum);
if (bsize < block_size) {
SMB_BIG_UINT factor = block_size/bsize;
@ -1907,7 +1912,9 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
{
SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
data_len = 32;
SMB_VFS_DISK_FREE(conn,".",False,&bsize,&dfree,&dsize);
if (SMB_VFS_DISK_FREE(conn,".",False,&bsize,&dfree,&dsize) == (SMB_BIG_UINT)-1) {
return(UNIXERROR(ERRHRD,ERRgeneral));
}
block_size = lp_block_size(snum);
if (bsize < block_size) {
SMB_BIG_UINT factor = block_size/bsize;