]> git.pld-linux.org Git - packages/nfs-utils.git/blob - knfsd-rquotad.patch
- fix rpc.rquotad to correctly recognize devices subdirectories in /dev
[packages/nfs-utils.git] / knfsd-rquotad.patch
1 diff -ur knfsd-1.5.2.orig/utils/rquotad/hasquota.c knfsd-1.5.2/utils/rquotad/hasquota.c
2 --- knfsd-1.5.2.orig/utils/rquotad/hasquota.c   Sat Sep 25 02:49:36 1999
3 +++ knfsd-1.5.2/utils/rquotad/hasquota.c        Sun Nov 21 00:09:06 1999
4 @@ -51,7 +51,7 @@
5     if (((type == USRQUOTA) && (option = hasmntopt(mnt, MNTOPT_USRQUOTA)) != (char *)0) ||
6         ((type == GRPQUOTA) && (option = hasmntopt(mnt, MNTOPT_GRPQUOTA)) != (char *)0)) {
7        if ((pathname = strchr(option, '=')) == (char *)0) {
8 -         *qfnamep=xmalloc(strlen(mnt->mnt_dir)+strlen(qfname)+strlen(qfextension[type])+2);
9 +         *qfnamep=xmalloc(strlen(mnt->mnt_dir)+strlen(qfname)+strlen(qfextension[type])+3);
10           (void) sprintf(*qfnamep, "%s%s%s.%s", mnt->mnt_dir,
11                         (mnt->mnt_dir[strlen(mnt->mnt_dir) - 1] == '/') ? "" : "/",
12                         qfname, qfextension[type]);
13 diff -ur knfsd-1.5.2.orig/utils/rquotad/rquota_server.c knfsd-1.5.2/utils/rquotad/rquota_server.c
14 --- knfsd-1.5.2.orig/utils/rquotad/rquota_server.c      Sat Sep 25 02:49:38 1999
15 +++ knfsd-1.5.2/utils/rquotad/rquota_server.c   Sat Nov 20 19:40:15 1999
16 @@ -50,10 +50,10 @@
17  
18  char *nfsmount_to_devname(char *pathname, int *blksize)
19  {
20 -   DIR *dp;
21 +   FILE *fp;
22     dev_t device;
23     struct stat st;
24 -   struct dirent *de;
25 +   struct mntent *mnt;
26     static char *devicename = NULL;
27     static int devicelen = 0;
28  
29 @@ -63,42 +63,29 @@
30     device = st.st_dev;
31     *blksize = st.st_blksize;
32  
33 -   /*
34 -    * search for devicename in _PATH_DEV_DSK dir.
35 -    */
36 -   if ((dp = opendir(_PATH_DEV_DSK)) == (DIR *)0)
37 -      return (char *)0;
38 -
39 -   while ((de = readdir(dp)) != (struct dirent *)0) {
40 -      if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, ".."))
41 -         continue;
42 -
43 -      if (devicelen == 0) {
44 -        devicelen = sizeof (_PATH_DEV_DSK) + strlen (de->d_name) + 1;
45 -        devicename = (char *) xmalloc (devicelen);
46 -      }
47 -      else {
48 -         int newlen = sizeof (_PATH_DEV_DSK) + strlen (de->d_name) + 1;
49 -         if (newlen > devicelen) {
50 -             devicelen = newlen;
51 -             devicename = (char *) xrealloc (devicename, devicelen);
52 -         }
53 -      }
54 -
55 -      strcpy(devicename, _PATH_DEV_DSK);
56 -      strcat(devicename, de->d_name);
57 -      if (stat(devicename, &st) == -1)
58 +   fp = setmntent(MNTTAB, "r");
59 +   while ((mnt = getmntent(fp)) != (struct mntent *)0) {
60 +      if (stat(mnt->mnt_fsname, &st) == -1)
61           continue;
62  
63 -      if (!S_ISBLK(st.st_mode))
64 -         continue;
65 -
66 -      if ((device == st.st_rdev) && S_ISBLK(st.st_mode))
67 +      if ((device == st.st_rdev) && S_ISBLK(st.st_mode)) {
68 +        if (devicelen == 0) {
69 +           devicelen = strlen (mnt->mnt_fsname) + 1;
70 +           devicename = (char *) xmalloc (devicelen);
71 +        } else {
72 +           int newlen = strlen (mnt->mnt_fsname) + 1;
73 +           if (newlen > devicelen) {
74 +              devicelen = newlen;
75 +              devicename = (char *) xrealloc (devicename, devicelen);
76 +           }
77 +        }
78 +        strcpy(devicename, mnt->mnt_fsname);
79           break;
80 +      }
81     }
82 -   closedir(dp);
83 +   endmntent(fp);
84  
85 -   if (de != (struct dirent *)0) {
86 +   if (mnt != (struct mntent *)0) {
87        return devicename;
88     } else
89        return (char *)0;
This page took 0.037866 seconds and 4 git commands to generate.