]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
eject: remove MountableDevice function
authorMichal Luscon <mluscon@redhat.com>
Wed, 8 Feb 2012 15:14:38 +0000 (16:14 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Mar 2012 11:04:58 +0000 (13:04 +0200)
Signed-off-by: Michal Luscon <mluscon@redhat.com>
misc-utils/eject.c

index 974e566aa288d528cc8695ab38d2524c8c282d2f..8d8a8bf3fc8c2f2e7d947f73d807bc4cca81a68a 100644 (file)
@@ -681,47 +681,6 @@ static int MountedDevice(const char *name, char **mountName, char **deviceName)
 }
 
 
-/*
- * See if device can be mounted by looking in /etc/fstab.
- * If so, set device name and mount point name, and return 1,
- * otherwise return 0.
- */
-static int MountableDevice(const char *name, char **mountName, char **deviceName)
-{
-       FILE *fp;
-       char line[1024];
-       char s1[1024];
-       char s2[1024];
-       int rc;
-
-       fp = fopen("/etc/fstab", "r");
-       if (fp == NULL) {
-/*
- * /etc/fstab may be unreadable in some situations due to passwords in the
- * file.
- */
-/*             fprintf(stderr, _("%s: unable to open /etc/fstab: %s\n"), programName, strerror(errno));
-               exit(1);*/
-               if (v_option) {
-                       warn( _("unable to open /etc/fstab") );
-               }
-               return -1;
-       }
-
-       while (fgets(line, sizeof(line), fp) != 0) {
-               rc = sscanf(line, "%1023s %1023s", s1, s2);
-               if (rc >= 2 && s1[0] != '#' && strcmp(s2, name) == 0) {
-                       e_fclose(fp);
-                       *deviceName = strdup(s1);
-                       *mountName = strdup(s2);
-                       return 1;
-               }
-       }
-       e_fclose(fp);
-       return 0;
-}
-
-
 /*
  * Step through mount table and unmount all devices that match a regular
  * expression.
@@ -900,18 +859,6 @@ int main(int argc, char **argv)
                deviceName = strdup(fullName);
        }
 
-       /* if not currently mounted, see if it is a possible mount point */
-       if (!mounted) {
-               mountable = MountableDevice(fullName, &mountName, &deviceName);
-               /* if return value -1 then fstab could not be read */
-               if (v_option && mountable >= 0) {
-                       if (mountable)
-                               printf(_("%s: `%s' can be mounted at `%s'\n"), programName, deviceName, mountName);
-                       else
-                               printf(_("%s: `%s' is not a mount point\n"), programName, fullName);
-               }
-       }
-
        /* handle -n option */
        if (n_option) {
                printf(_("%s: device is `%s'\n"), programName, deviceName);