summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-03-16 01:41:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:03 -0500
commit7dcbde86ae22379b67d0a571c93aa34b2a1311aa (patch)
tree4502511b1aa3be03c0f7404fe7abcce3fc387e42
parent99db77b2b2ce078c1097aaca2631aeee35544f5a (diff)
downloadsamba-7dcbde86ae22379b67d0a571c93aa34b2a1311aa.tar.gz
samba-7dcbde86ae22379b67d0a571c93aa34b2a1311aa.tar.bz2
samba-7dcbde86ae22379b67d0a571c93aa34b2a1311aa.zip
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 b5d31b2caf5c4739607bf57cb7e4e0569b57012b)
-rw-r--r--source3/smbd/dfree.c15
-rw-r--r--source3/smbd/reply.c5
-rw-r--r--source3/smbd/trans2.c13
3 files changed, 26 insertions, 7 deletions
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index c556c8c8ab..81a48b94fc 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -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 {
+ 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);
+ }
if (disk_quotas(path, &bsize_q, &dfree_q, &dsize_q)) {
(*bsize) = bsize_q;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 326dafd678..e8ee9ffe92 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -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);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 54234deb35..e4e1243d68 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -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;