Fixed compile warnings for FreeBsd & Linux.
authorSamba Release Account <samba-bugs@samba.org>
Wed, 2 Jul 1997 01:19:41 +0000 (01:19 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Wed, 2 Jul 1997 01:19:41 +0000 (01:19 +0000)
Jeremy (jallison@whistle.com).
(This used to be commit 93352e1aae9a1af7036cf56da820356cefe3698b)

source3/smbd/quotas.c

index a1d29bcd12e71238837e7090eab6980a9adce241..e6a6f6156891799141e563ab65d46f3ea33947f2 100644 (file)
@@ -50,7 +50,6 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
 {
   uid_t euser_id;
   int r;
-  char dev_disk[256];
   struct dqblk D;
   struct stat S;
   FILE *fp;
@@ -378,12 +377,12 @@ try to get the disk space from disk quotas - default version
 ****************************************************************************/
 BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
 {
-  uid_t user_id, euser_id;
+  uid_t euser_id;
   int r;
-  char dev_disk[256];
   struct dqblk D;
-  struct stat S;
 #ifndef __FreeBSD__
+  char dev_disk[256];
+  struct stat S;
   /* find the block device file */
   if ((stat(path, &S)<0) ||
       (devnm(S_IFBLK, S.st_dev, dev_disk, 256, 0)<0)) return (False);
@@ -392,12 +391,16 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
   euser_id = geteuid();
 
 #ifdef USE_SETRES
-  /* for HPUX, real uid must be same as euid to execute quotactl for euid */
-  user_id = getuid();
-  setresuid(euser_id,-1,-1);
-  r=quotactl(Q_GETQUOTA, dev_disk, euser_id, &D);
-  if (setresuid(user_id,-1,-1))
-    DEBUG(5,("Unable to reset uid to %d\n", user_id));
+  {
+    uid_t user_id;
+
+    /* for HPUX, real uid must be same as euid to execute quotactl for euid */
+    user_id = getuid();
+    setresuid(euser_id,-1,-1);
+    r=quotactl(Q_GETQUOTA, dev_disk, euser_id, &D);
+    if (setresuid(user_id,-1,-1))
+      DEBUG(5,("Unable to reset uid to %d\n", user_id));
+  }
 #else
 #if defined(__FreeBSD__)
   r= quotactl(path,Q_GETQUOTA,euser_id,(char *) &D);