1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 09:07:10 +03:00

Merge pull request #274 from akawashiro/show-errno

Show errno for ftruncate and fchmod
This commit is contained in:
Rui Ueyama 2022-01-18 15:07:15 +09:00 committed by GitHub
commit e6d1d011ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -39,10 +39,10 @@ public:
}
if (ftruncate(fd, filesize))
Fatal(ctx) << "ftruncate failed";
Fatal(ctx) << "ftruncate failed: " << errno_string();
if (fchmod(fd, (perm & ~get_umask())) == -1)
Fatal(ctx) << "fchmod failed";
Fatal(ctx) << "fchmod failed: " << errno_string();
this->buf = (u8 *)mmap(nullptr, filesize, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);

View File

@ -32,9 +32,9 @@ public:
Fatal(ctx) << "cannot open " << output_tmpfile << ": " << errno_string();
if (ftruncate(fd, filesize))
Fatal(ctx) << "ftruncate failed";
Fatal(ctx) << "ftruncate failed: " << errno_string();
if (fchmod(fd, perm) == -1)
Fatal(ctx) << "fchmod failed";
Fatal(ctx) << "fchmod failed: " << errno_string();
this->buf = (u8 *)mmap(nullptr, filesize, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);