diff --git a/lib/driver/solaris.c b/lib/driver/solaris.c index 6ff40db0..a747787c 100644 --- a/lib/driver/solaris.c +++ b/lib/driver/solaris.c @@ -284,6 +284,7 @@ run_mmc_cmd_solaris( void *p_user_data, unsigned int i_timeout_ms, { const _img_private_t *p_env = p_user_data; struct uscsi_cmd cgc; + int i_rc; memset (&cgc, 0, sizeof (struct uscsi_cmd)); cgc.uscsi_cdb = (caddr_t) p_cdb; @@ -296,7 +297,29 @@ run_mmc_cmd_solaris( void *p_user_data, unsigned int i_timeout_ms, cgc.uscsi_buflen = i_buf; cgc.uscsi_cdblen = i_cdb; - return ioctl(p_env->gen.fd, USCSICMD, &cgc); + i_rc = ioctl(p_env->gen.fd, USCSICMD, &cgc); + if (0 == i_rc) return DRIVER_OP_SUCCESS; + if (-1 == i_rc) { + cdio_info ("ioctl USCSICMD failed: %s", strerror(errno)); + switch (errno) { + case EPERM: + return DRIVER_OP_NOT_PERMITTED; + break; + case EINVAL: + return DRIVER_OP_BAD_PARAMETER; + break; + case EFAULT: + return DRIVER_OP_BAD_POINTER; + break; + case EIO: + default: + return DRIVER_OP_ERROR; + break; + } + return DRIVER_OP_ERROR; + } + /*Not sure if this the best thing, but we'll use anyway. */ + return DRIVER_OP_SUCCESS; } /*! diff --git a/lib/iso9660/iso9660.c b/lib/iso9660/iso9660.c index a365f7bd..3dbbd0c2 100644 --- a/lib/iso9660/iso9660.c +++ b/lib/iso9660/iso9660.c @@ -81,7 +81,7 @@ timegm(struct tm *tm) char *tz; tz = getenv("TZ"); - setenv("TZ", "UTC", 1); + setenv("TZ", "", 1); tzset(); ret = mktime(tm); if (tz) @@ -344,7 +344,7 @@ iso9660_set_dtime (const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date) /* Convert seconds to minutes */ timezone = p_tm->tm_gmtoff / 60; #else - timezone = (p_tm->tm_isdst > 0) ? 0 : -60; + timezone = (p_tm->tm_isdst > 0) ? -60 : 0; #endif iso9660_set_dtime_with_timezone (p_tm, timezone, p_idr_date); } @@ -397,7 +397,7 @@ iso9660_set_ltime (const struct tm *p_tm, /*out*/ iso9660_ltime_t *pvd_date) /* Set time zone in 15-minute interval encoding. */ timezone = p_tm->tm_gmtoff / 60; #else - timezone = (p_tm->tm_isdst > 0) ? 0 : -60; + timezone = (p_tm->tm_isdst > 0) ? -60 : 0; #endif iso9660_set_ltime_with_timezone (p_tm, timezone, pvd_date); } diff --git a/test/.gitignore b/test/.gitignore index d8fd123d..beb0776c 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -34,4 +34,5 @@ /testparanoia /testpregap /testpregap.c +/testsolaris /testtoc diff --git a/test/Makefile.am b/test/Makefile.am index e395427f..0e9f7367 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -28,7 +28,7 @@ endif hack = check_sizeof testassert testbincue testgetdevices testischar \ testisocd testisocd2 testiso9660 testlinux \ - testnrg $(testparanoia) testtoc testpregap + testnrg $(testparanoia) testtoc testpregap testsolaris EXTRA_PROGRAMS = testdefault @@ -50,6 +50,9 @@ testtoc_CFLAGS = -DTEST_DIR=\"$(srcdir)\" testlinux_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) testlinux_CFLAGS = -DTEST_DIR=\"$(srcdir)\" +testsolaris_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) +testsolaris_CFLAGS = -DTEST_DIR=\"$(srcdir)\" + testpregap_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) testpregap_CFLAGS = -DTEST_DIR=\"$(srcdir)\" diff --git a/test/testsolaris.c b/test/testsolaris.c new file mode 100644 index 00000000..f66ffe67 --- /dev/null +++ b/test/testsolaris.c @@ -0,0 +1,85 @@ +/* -*- C -*- + Copyright (C) 2009 Rocky Bernstein + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + Regression test for cdio_nrgfile(). +*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include + +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#include + +int +main(int argc, const char *argv[]) +{ + CdIo_t *p_cdio; + char **ppsz_drives=NULL; + + cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO; + /* snprintf(psz_nrgfile, sizeof(psz_nrgfile)-1, + "%s/%s", TEST_DIR, cue_file[i]); + */ + if (!cdio_have_driver(DRIVER_SOLARIS)) return(77); + 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_linux(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_destroy(p_cdio); + p_cdio = cdio_open_am_linux(ppsz_drives[0], "SCSI"); + if (p_cdio) { + const char *psz_access_mode = cdio_get_arg(p_cdio, "access-mode"); + + if (0 != strncmp(psz_access_mode, "SCSI", strlen("SCSI"))) { + fprintf(stderr, + "Got %s; Should get back %s, the access mode requested.\n", + psz_access_mode, "SCSI"); + exit(2); + } + } + + cdio_destroy(p_cdio); + cdio_free_device_list(ppsz_drives); + + return 0; +}