mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 22:07:58 +08:00
Fix call to system fallocate to handle errno correctly.
2021-03-19 Holger Berger <holger.berger@googlemail.com> gold/ PR gold/26541 * output.cc (gold_fallocate): Use errno when calling system fallocate.
This commit is contained in:

committed by
Cary Coutant

parent
cc1849716f
commit
07b1c3dbd9
@ -1,3 +1,8 @@
|
|||||||
|
2021-03-19 Holger Berger <holger.berger@googlemail.com>
|
||||||
|
|
||||||
|
PR gold/26541
|
||||||
|
* output.cc (gold_fallocate): Use errno when calling system fallocate.
|
||||||
|
|
||||||
2021-03-19 Cary Coutant <ccoutant@gmail.com>
|
2021-03-19 Cary Coutant <ccoutant@gmail.com>
|
||||||
|
|
||||||
PR gold/26585
|
PR gold/26585
|
||||||
|
@ -141,12 +141,14 @@ gold_fallocate(int o, off_t offset, off_t len)
|
|||||||
|
|
||||||
#ifdef HAVE_FALLOCATE
|
#ifdef HAVE_FALLOCATE
|
||||||
{
|
{
|
||||||
|
errno = 0;
|
||||||
int err = ::fallocate(o, 0, offset, len);
|
int err = ::fallocate(o, 0, offset, len);
|
||||||
if (err != EINVAL && err != ENOSYS && err != EOPNOTSUPP)
|
if (err < 0 && errno != EINVAL && errno != ENOSYS && errno != EOPNOTSUPP)
|
||||||
return err;
|
return errno;
|
||||||
}
|
}
|
||||||
#endif // defined(HAVE_FALLOCATE)
|
#endif // defined(HAVE_FALLOCATE)
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
if (::ftruncate(o, offset + len) < 0)
|
if (::ftruncate(o, offset + len) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user