diff --git a/parted/parted.c b/parted/parted.c index 46999f5..be66620 100644 --- a/parted/parted.c +++ b/parted/parted.c @@ -1566,9 +1566,26 @@ _print_list () { PedDevice *current_dev = NULL; - ped_device_probe_all(); +#ifdef HAVE_GETUID + if (getuid() != 0 && !opt_script_mode) { + puts (_("WARNING: You are not superuser. Watch out for " + "permissions.")); + } +#endif + +retry: + ped_device_probe_all (); + current_dev = ped_device_get_next (NULL); + + if (!current_dev) { + if (ped_exception_throw (PED_EXCEPTION_ERROR, + PED_EXCEPTION_RETRY_CANCEL, + _("No device found")) + == PED_EXCEPTION_RETRY) + goto retry; + } - while ((current_dev = ped_device_get_next(current_dev))) { + while (current_dev) { do_print (¤t_dev); putchar ('\n'); }