a92be000fb
realpath: Fixing undefined behaviour in the second test. If the call fails the resolved_name argument cannot be used for error checking because its state is undefined by SUSv2. pipe: Changing the order of close and write error handling code. Errors in close could overwrite errno after write errors, returning incorrect error messages. gmtime: Removed duplicate checks Other fixes for fseek, rename, mktime, putwchar
22 lines
833 B
C
22 lines
833 B
C
#include <time.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "test_helpers.h"
|
|
|
|
int main(void) {
|
|
time_t a = 0;
|
|
struct tm expected = { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_year = 70,
|
|
.tm_wday = 4, .tm_yday = 0, .tm_isdst = 0, .tm_gmtoff = 0, .tm_zone = "UTC" };
|
|
|
|
struct tm *info = gmtime(&a);
|
|
if (info->tm_sec != expected.tm_sec || info->tm_min != expected.tm_min ||
|
|
info->tm_hour != expected.tm_hour || info->tm_mday != expected.tm_mday ||
|
|
info->tm_year != expected.tm_year || info->tm_wday != expected.tm_wday ||
|
|
info->tm_yday != expected.tm_yday || info->tm_isdst != expected.tm_isdst ||
|
|
info->tm_gmtoff != expected.tm_gmtoff || strcmp(info->tm_zone, expected.tm_zone) != 0) {
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
}
|