mtpt[0] = 0;
retval = check_mount_point(devname, &mount_flags, mtpt, sizeof(mtpt));
if (retval == 0) {
+ const char *msg = NULL;
+
if (mount_flags & MF_MOUNTED) {
if (!mtpt[0])
- strcpy(mtpt, _("(mounted, mtpt unknown)"));
+ msg = _("(mounted, mtpt unknown)");
} else if (mount_flags & MF_BUSY)
- strcpy(mtpt, _("(in use)"));
+ msg = _("(in use)");
else
- strcpy(mtpt, _("(not mounted)"));
+ msg = _("(not mounted)");
+
+ if (msg)
+ xstrncpy(mtpt, msg, sizeof(mtpt));
}
pretty_print_line(devname, fs_type, label, mtpt, uuid);
int rc = 0;
static int first = 1;
- fd = open(devname, O_RDONLY|O_CLOEXEC);
+ fd = open(devname, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
if (fd < 0) {
warn(_("error: %s"), devname);
return BLKID_EXIT_NOTFOUND;
}
- if (blkid_probe_set_device(pr, fd, ctl->offset, ctl->size))
+ errno = 0;
+ if (blkid_probe_set_device(pr, fd, ctl->offset, ctl->size)) {
+ if (errno)
+ warn(_("error: %s"), devname);
goto done;
+ }
if (ctl->lowprobe_topology)
rc = lowprobe_topology(pr);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(BLKID_EXIT_OTHER);