Skip to content

Commit bc73e94

Browse files
fix the actual underlying issue.
1 parent 79bd70d commit bc73e94

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

libc/include/llvm-libc-types/suseconds_t.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
#ifndef LLVM_LIBC_TYPES_SUSECONDS_T_H
1010
#define LLVM_LIBC_TYPES_SUSECONDS_T_H
1111

12-
typedef __INT32_TYPE__ suseconds_t;
12+
// Per posix: suseconds_t shall be a signed integer type capable of storing
13+
// values at least in the range [-1, 1000000]. [...] the widths of [other
14+
// types...] and suseconds_t are no greater than the width of type long.
15+
16+
// The kernel expects 64 bit suseconds_t at least on x86_64.
17+
typedef long suseconds_t;
1318

1419
#endif // LLVM_LIBC_TYPES_SUSECONDS_T_H

libc/test/src/sys/time/utimes_test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
#include "test/UnitTest/ErrnoSetterMatcher.h"
1818
#include "test/UnitTest/Test.h"
1919

20+
#include <sys/stat.h>
21+
2022
// SUCCESS: Takes a file and successfully updates
2123
// its last access and modified times.
2224
TEST(LlvmLibcUtimesTest, ChangeTimesSpecific) {
2325
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
2426

2527
constexpr const char *FILE_PATH = "utimes_pass.test";
2628
auto TEST_FILE = libc_make_test_file_path(FILE_PATH);
27-
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT);
29+
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
30+
ASSERT_ERRNO_SUCCESS();
2831
ASSERT_GT(fd, 0);
2932
ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
3033

@@ -63,7 +66,7 @@ TEST(LlvmLibcUtimesTest, InvalidMicroseconds) {
6366

6467
constexpr const char *FILE_PATH = "utimes_fail.test";
6568
auto TEST_FILE = libc_make_test_file_path(FILE_PATH);
66-
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT);
69+
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
6770
ASSERT_GT(fd, 0);
6871
ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
6972

0 commit comments

Comments
 (0)