Correct cdio_get_devices for FreeBSD.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
$Id: freebsd.c,v 1.38 2008/04/21 18:30:20 karl Exp $
|
||||
|
||||
Copyright (C) 2003, 2004, 2005, 2008, 2009 Rocky Bernstein <rocky@gnu.org>
|
||||
Copyright (C) 2003, 2004, 2005, 2008, 2009, 2010
|
||||
Rocky Bernstein <rocky@gnu.org>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -766,14 +767,21 @@ get_media_changed_freebsd (const void *p_user_data)
|
||||
}
|
||||
|
||||
static const char*
|
||||
get_access_mode(const char *source)
|
||||
get_access_mode(const char *psz_source)
|
||||
{
|
||||
if (source) {
|
||||
if (!(strncmp(source, "/dev/acd", 8)))
|
||||
char *psz_src;
|
||||
if (!psz_source) {
|
||||
psz_src = cdio_get_default_device_freebsd();
|
||||
} else {
|
||||
psz_src = strdup(psz_source);
|
||||
}
|
||||
|
||||
if (psz_src) {
|
||||
if (!(strncmp(psz_src, "/dev/acd", 8)))
|
||||
return "ioctl";
|
||||
else {
|
||||
char devname[256];
|
||||
int bytes = readlink(source, devname, 255);
|
||||
int bytes = readlink(psz_src, devname, 255);
|
||||
|
||||
if (bytes > 0) {
|
||||
devname[bytes]=0;
|
||||
|
||||
@@ -57,8 +57,25 @@ main(int argc, const char *argv[])
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
cdio_destroy(p_cdio);
|
||||
|
||||
ppsz_drives = cdio_get_devices(DRIVER_DEVICE);
|
||||
if (!ppsz_drives) {
|
||||
printf("Can't find a CD-ROM drive. Skipping test.\n");
|
||||
exit(77);
|
||||
}
|
||||
|
||||
p_cdio = cdio_open_freebsd(ppsz_drives[0]);
|
||||
if (p_cdio) {
|
||||
const char *psz_source = cdio_get_arg(p_cdio, "source");
|
||||
if (0 != strncmp(psz_source, ppsz_drives[0],
|
||||
strlen(ppsz_drives[0]))) {
|
||||
fprintf(stderr,
|
||||
"Got %s; should get back %s, the name we opened.\n",
|
||||
psz_source, ppsz_drives[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
cdio_free_device_list(ppsz_drives);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user