Check for error status of iso9660_get_dtime and iso9660_get_ltime

This commit is contained in:
rocky
2007-07-19 02:03:39 +00:00
parent 89dffd31a3
commit f27e1bfb72

View File

@@ -1,7 +1,7 @@
/* /*
$Id: testiso9660.c,v 1.17 2006/07/30 14:10:16 rocky Exp $ $Id: testiso9660.c,v 1.18 2007/07/19 02:03:39 rocky Exp $
Copyright (C) 2003, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -253,11 +253,15 @@ main (int argc, const char *argv[])
} }
p_tm = gmtime(&now); p_tm = gmtime(&now);
iso9660_set_dtime(p_tm, &dtime); iso9660_set_dtime(p_tm, &dtime);
iso9660_get_dtime(&dtime, false, &tm); if (!iso9660_get_dtime(&dtime, false, &tm)) {
printf("Error returned by iso9660_get_dtime\n");
return 42;
}
if ( memcmp(p_tm, &tm, sizeof(tm)) != 0 ) { if ( memcmp(p_tm, &tm, sizeof(tm)) != 0 ) {
printf("GMT time retrieved with iso9660_get_dtime() not same as that\n"); printf("GMT time retrieved with iso9660_get_dtime() not same as that\n");
printf("set with iso9660_set_dtime().\n"); printf("set with iso9660_set_dtime().\n");
return 42; return 43;
} }
{ {
@@ -265,12 +269,17 @@ main (int argc, const char *argv[])
p_tm = localtime(&now); p_tm = localtime(&now);
t1 = mktime(p_tm); t1 = mktime(p_tm);
iso9660_set_ltime(p_tm, &ltime); iso9660_set_ltime(p_tm, &ltime);
iso9660_get_ltime(&ltime, &tm);
if (!iso9660_get_ltime(&ltime, &tm)) {
printf("Problem running iso966)get_ltime\n");
return 44;
}
t2 = mktime(&tm); t2 = mktime(&tm);
if ( t1 != t2 && ! time_compare(p_tm, &tm) ) { if ( t1 != t2 && ! time_compare(p_tm, &tm) ) {
printf("local time retrieved with iso9660_get_ltime() not\n"); printf("local time retrieved with iso9660_get_ltime() not\n");
printf("same as that set with iso9660_set_ltime().\n"); printf("same as that set with iso9660_set_ltime().\n");
return 43; return 45;
} }
p_tm = gmtime(&now); p_tm = gmtime(&now);
@@ -281,7 +290,7 @@ main (int argc, const char *argv[])
if ( t1 != t2 && ! time_compare(p_tm, &tm) ) { if ( t1 != t2 && ! time_compare(p_tm, &tm) ) {
printf("GMT time retrieved with iso9660_get_ltime() not\n"); printf("GMT time retrieved with iso9660_get_ltime() not\n");
printf("same as that set with iso9660_set_ltime().\n"); printf("same as that set with iso9660_set_ltime().\n");
return 44; return 46;
} }
} }
} }