Skip to content

Commit c58896c

Browse files
authored
fix k2::stat call (#1506)
1 parent 10d0394 commit c58896c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

runtime-light/stdlib/file/file-system-functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ std::optional<image_info> get_png_info(size_t read_size, std::span<unsigned char
317317
mixed f$getimagesize(const string& name) noexcept {
318318
// TODO implement k2::fstat, with fd as parameter
319319
struct stat stat_buf {};
320-
if (k2::stat({name.c_str(), name.size()}, std::addressof(stat_buf)) != k2::errno_ok) {
320+
if (!k2::stat({name.c_str(), name.size()}, std::addressof(stat_buf)).has_value()) {
321321
return false;
322322
}
323323

runtime-light/stdlib/file/file-system-functions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ inline Optional<array<string>> f$file(const string& name) noexcept {
210210
if (!expected_file.has_value()) {
211211
return false;
212212
}
213-
if (!k2::stat(name.c_str(), std::addressof(stat_buf)).has_value()) {
213+
if (!k2::stat({name.c_str(), name.size()}, std::addressof(stat_buf)).has_value()) {
214214
return false;
215215
}
216216
if (!S_ISREG(stat_buf.st_mode)) {

0 commit comments

Comments
 (0)