[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 691015fedb: Fix filelock.c for Haiku
From: |
Po Lu |
Subject: |
Re: master 691015fedb: Fix filelock.c for Haiku |
Date: |
Mon, 10 Jan 2022 08:08:16 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> diff --git a/src/filelock.c b/src/filelock.c
>> index a213c2b3ca..8453f17cd4 100644
>> --- a/src/filelock.c
>> +++ b/src/filelock.c
>> @@ -608,7 +608,7 @@ lock_if_free (lock_info_type *clasher, char *lfname)
>> err = current_lock_owner (clasher, lfname);
>> if (err != 0)
>> {
>> - if (err < 0)
>> + if (err == -1 || err == -2)
>> return -2 - err; /* We locked it, or someone else has it. */
>> break; /* current_lock_owner returned strange error. */
>> }
>> @@ -616,7 +616,14 @@ lock_if_free (lock_info_type *clasher, char *lfname)
>> /* We deleted a stale lock; try again to lock the file. */
>> }
>>
>> +#if !defined HAIKU \
>> + || defined BE_USE_POSITIVE_POSIX_ERRORS
>> return err;
>> +#else
>> + /* On Haiku, POSIX error values are negative by default, but this
>> + code's callers assume that any errno value is positive. */
>> + return -err;
>> +#endif
>> }
>
> Is it guaranteed that no errno value on Haiku cam ever be -1 or -2?
Yes.
> Do we perhaps want to add an assertion to that effect?
I don't think that's necessary.
> Btw, what kind of errno values does Haiku use? what do you see in the
> errno.h header there? are all the values negative?
They're aliased to BeOS error codes, which are all negative by quite a
large value (INT_MIN + error_code).