Browse Source

Bugfix

master
Andrea Luzzardi 18 years ago
parent
commit
19574615e1
2 changed files with 7 additions and 12 deletions
  1. +1
    -1
      pam_usb/src/device.c
  2. +6
    -11
      pam_usb/src/volume.c

+ 1
- 1
pam_usb/src/device.c View File

@ -32,7 +32,7 @@ static LibHalDrive *pusb_device_get_storage(t_pusb_options *opts, LibHalContext
int maxloop = 0; int maxloop = 0;
LibHalDrive *drive = NULL; LibHalDrive *drive = NULL;
log_info("Waiting for storage device probing...\n");
log_info("Probing storage device (this could take a while)...\n");
while (!(phy_udi = pusb_hal_find_item(ctx, while (!(phy_udi = pusb_hal_find_item(ctx,
"info.parent", udi, "info.parent", udi,
"info.bus", "usb", "info.bus", "usb",


+ 6
- 11
pam_usb/src/volume.c View File

@ -33,23 +33,17 @@ static int pusb_volume_mount(t_pusb_options *opts, LibHalVolume **volume,
char command[1024]; char command[1024];
char tempname[32]; char tempname[32];
const char *devname; const char *devname;
const char *fs;
snprintf(tempname, sizeof(tempname), "pam_usb%d", getpid()); snprintf(tempname, sizeof(tempname), "pam_usb%d", getpid());
if (!(fs = libhal_volume_get_fstype(*volume)))
{
log_error("Unable to retrieve filesystem type\n");
return (0);
}
if (!(devname = libhal_volume_get_device_file(*volume))) if (!(devname = libhal_volume_get_device_file(*volume)))
{ {
log_error("Unable to retrieve device filename\n"); log_error("Unable to retrieve device filename\n");
return (0); return (0);
} }
log_debug("Attempting to mount device %s with label %s (fs: %s)\n",
devname, tempname, fs);
snprintf(command, sizeof(command), "pmount -s -t %s %s %s",
fs, devname, tempname);
log_debug("Attempting to mount device %s with label %s\n",
devname, tempname);
snprintf(command, sizeof(command), "pmount -s %s %s",
devname, tempname);
log_debug("Executing \"%s\"\n", command); log_debug("Executing \"%s\"\n", command);
if (system(command) != 0) if (system(command) != 0)
{ {
@ -72,7 +66,7 @@ static int pusb_volume_mount(t_pusb_options *opts, LibHalVolume **volume,
free((char *)udi); free((char *)udi);
} }
log_debug("Mount succeeded.\n"); log_debug("Mount succeeded.\n");
return (libhal_volume_is_mounted(*volume));
return (1);
} }
static int __pusb_volume_find(t_pusb_options *opts, LibHalContext *ctx, static int __pusb_volume_find(t_pusb_options *opts, LibHalContext *ctx,
@ -154,6 +148,7 @@ void pusb_volume_destroy(LibHalVolume *volume)
log_debug("Attempting to umount %s\n", log_debug("Attempting to umount %s\n",
mntpoint); mntpoint);
snprintf(command, sizeof(command), "pumount %s", mntpoint); snprintf(command, sizeof(command), "pumount %s", mntpoint);
log_debug("Executing \"%s\"\n", command);
if (!system(command)) if (!system(command))
log_debug("Umount succeeded.\n"); log_debug("Umount succeeded.\n");
else else


Loading…
Cancel
Save