+ /* try to drop all privileges before reading disk content */
+ if (getuid() == 0) {
+ struct passwd *pw;
+
+ pw = getpwnam("nobody");
+ if (pw != NULL && pw->pw_uid > 0 && pw->pw_gid > 0) {
+ if (setgroups(0, NULL) != 0 ||
+ setgid(pw->pw_gid) != 0 ||
+ setuid(pw->pw_uid) != 0)
+ info(udev_ctx, "unable to drop privileges: %s\n\n", strerror(errno));
+ }
+ }
+
+ if (probe_all) {
+ volume_id_all_probers(all_probers, vid, offset, size, NULL);
+ goto exit;
+ }
+
+ if (skip_raid)
+ retval = volume_id_probe_filesystem(vid, offset, size);
+ else
+ retval = volume_id_probe_all(vid, offset, size);
+ if (retval != 0) {
+ fprintf(stderr, "unknown or non-unique volume type "
+ "(--probe-all lists possibly conflicting types)\n");
+ rc = 4;
+ goto exit;
+ }
+
+ if (!volume_id_get_label(vid, &label) ||
+ !volume_id_get_usage(vid, &usage) ||
+ !volume_id_get_type(vid, &type) ||
+ !volume_id_get_type_version(vid, &type_version) ||
+ !volume_id_get_uuid(vid, &uuid) ||
+ !volume_id_get_uuid_sub(vid, &uuid_sub)) {
+ rc = 4;
+ goto exit;
+ }
+
+ udev_util_replace_whitespace(label, label_safe, sizeof(label_safe));
+ udev_util_replace_chars(label_safe, UDEV_ALLOWED_CHARS_INPUT);
+ volume_id_encode_string(label, label_enc, sizeof(label_enc));
+
+ udev_util_replace_whitespace(uuid, uuid_safe, sizeof(uuid_safe));
+ udev_util_replace_chars(uuid_safe, UDEV_ALLOWED_CHARS_INPUT);
+ volume_id_encode_string(uuid, uuid_enc, sizeof(uuid_enc));