Skip to content
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1563003
Latest stdio destructor changes was creating a bad problem subtractin…
afxgroup Jan 14, 2025
d0ce9f2
Duplicate IO handles on CreateNewProc
afxgroup Jan 14, 2025
ceeeecb
Merge branch 'development' of github.com:AmigaLabs/clib4 into develop…
afxgroup Jan 14, 2025
5827b22
Merge branch 'development' of github.com:AmigaLabs/clib4 into develop…
afxgroup Jan 19, 2025
b6f9bdd
More WINDOWS to LINUX file ending conversion
afxgroup Jan 21, 2025
107cfed
Wrong Printf version requirement printing
afxgroup Jan 28, 2025
bd6b295
Merge branch 'development' of github.com:AmigaLabs/clib4 into line_en…
afxgroup Jan 28, 2025
2f80f55
Get DOSIFace in pthread_create from extern _IDOS
afxgroup Jan 30, 2025
7676191
Merge branch 'afxgroup' of github.com:AmigaLabs/clib4 into afxgroup
afxgroup Jan 30, 2025
989e54f
Added %b format type in printf
afxgroup Feb 8, 2025
ebd6998
Fix on dcngettext was crashing on bindtextdomain and on destructor
afxgroup Feb 9, 2025
03053e5
Added Amiga-1251 charset to iconv
afxgroup Feb 9, 2025
39f9de7
Removed __set_errno from librt since it isn't exported and undefined …
afxgroup Feb 12, 2025
6f9e9d7
Added dlopen example to test shared objects alog rpath and soname
afxgroup Feb 23, 2025
0894c8c
Removed some quirks from dlopen examples
afxgroup Feb 23, 2025
e9e190c
Added static_assert in assert.h
afxgroup Feb 28, 2025
2a0ea0f
Reverted back flock.c changes
afxgroup Feb 28, 2025
11e4d31
Merge branch 'development' of github.com:AmigaLabs/clib4 into afxgroup
afxgroup Feb 28, 2025
52259e3
Changed back (again..) flock.c
afxgroup Feb 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions library/fcntl/flock.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ flock(int fd, int op) {
int ret = -1;
struct flock lock;

if (op != LOCK_SH && op != LOCK_EX && op != LOCK_UN && op != LOCK_NB) {
if (op != LOCK_SH
&& op != LOCK_EX
&& op != LOCK_UN
&& op != (LOCK_SH|LOCK_NB)
&& op != (LOCK_EX|LOCK_NB)) {
__set_errno(EINVAL);
goto out;
}

/* Initialize the flock structure. */
memset(&lock, 0, sizeof(lock));

if (op == LOCK_SH) {
if (op & LOCK_SH) {
lock.l_type = F_RDLCK;
/* Place a shared (read) lock on the file. */
ret = fcntl(fd, F_SETLK, &lock);
}
else if (op == LOCK_EX) {
else if (op & LOCK_EX) {
lock.l_type = F_WRLCK;
/* Place an exclusive (write) lock on the file. */
ret = fcntl(fd, F_SETLK, &lock);
Expand Down