Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zathura
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jeremie Knuesel
zathura
Commits
b1ff5202
Commit
b1ff5202
authored
Jan 20, 2019
by
Sebastian Ramacher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use LOCK_{SH,EX} on Hurd
parent
34ee70f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
zathura/database-plain.c
zathura/database-plain.c
+11
-4
No files found.
zathura/database-plain.c
View file @
b1ff5202
...
...
@@ -36,12 +36,19 @@
#ifdef __GNU__
#include <sys/file.h>
#define FILE_LOCK_WRITE LOCK_EX
#define FILE_LOCK_READ LOCK_SH
static
int
file_lock_set
(
int
fd
,
int
cmd
)
{
return
flock
(
fd
,
cmd
);
}
#else
#define FILE_LOCK_WRITE F_WRLCK
#define FILE_LOCK_READ F_RDLCK
static
int
file_lock_set
(
int
fd
,
short
cmd
)
{
...
...
@@ -658,7 +665,7 @@ zathura_db_read_key_file_from_file(const char* path)
return
NULL
;
}
/* and lock it */
if
(
file_lock_set
(
fileno
(
file
),
F
_WRLCK
)
!=
0
)
{
if
(
file_lock_set
(
fileno
(
file
),
F
ILE_LOCK_WRITE
)
!=
0
)
{
fclose
(
file
);
return
NULL
;
}
...
...
@@ -732,7 +739,7 @@ zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file)
return
;
}
if
(
file_lock_set
(
fd
,
F
_WRLCK
)
!=
0
||
write
(
fd
,
content
,
strlen
(
content
))
==
0
)
{
if
(
file_lock_set
(
fd
,
F
ILE_LOCK_READ
)
!=
0
||
write
(
fd
,
content
,
strlen
(
content
))
==
0
)
{
girara_error
(
"Failed to write to %s"
,
file
);
}
close
(
fd
);
...
...
@@ -785,7 +792,7 @@ plain_io_read(GiraraInputHistoryIO* db)
}
/* read input history file */
if
(
file_lock_set
(
fileno
(
file
),
F
_RDLCK
)
!=
0
)
{
if
(
file_lock_set
(
fileno
(
file
),
F
ILE_LOCK_READ
)
!=
0
)
{
fclose
(
file
);
return
NULL
;
}
...
...
@@ -819,7 +826,7 @@ plain_io_append(GiraraInputHistoryIO* db, const char* input)
}
/* read input history file */
if
(
file_lock_set
(
fileno
(
file
),
F
_WRLCK
)
!=
0
)
{
if
(
file_lock_set
(
fileno
(
file
),
F
ILE_LOCK_WRITE
)
!=
0
)
{
fclose
(
file
);
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment