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
109
Issues
109
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwmt
zathura
Commits
34ee70f3
Commit
34ee70f3
authored
Jan 18, 2019
by
Sebastian Ramacher
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check locking errors
parent
a8f377f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
zathura/database-plain.c
zathura/database-plain.c
+15
-6
No files found.
zathura/database-plain.c
View file @
34ee70f3
...
...
@@ -653,10 +653,15 @@ zathura_db_read_key_file_from_file(const char* path)
}
/* open file */
FILE
*
file
=
fopen
(
path
,
"r
w
"
);
FILE
*
file
=
fopen
(
path
,
"r
+
"
);
if
(
file
==
NULL
)
{
return
NULL
;
}
/* and lock it */
if
(
file_lock_set
(
fileno
(
file
),
F_WRLCK
)
!=
0
)
{
fclose
(
file
);
return
NULL
;
}
GKeyFile
*
key_file
=
g_key_file_new
();
if
(
key_file
==
NULL
)
{
...
...
@@ -665,7 +670,6 @@ zathura_db_read_key_file_from_file(const char* path)
}
/* read config file */
file_lock_set
(
fileno
(
file
),
F_WRLCK
);
char
*
content
=
girara_file_read2
(
file
);
fclose
(
file
);
if
(
content
==
NULL
)
{
...
...
@@ -728,8 +732,7 @@ zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file)
return
;
}
file_lock_set
(
fd
,
F_WRLCK
);
if
(
write
(
fd
,
content
,
strlen
(
content
))
==
0
)
{
if
(
file_lock_set
(
fd
,
F_WRLCK
)
!=
0
||
write
(
fd
,
content
,
strlen
(
content
))
==
0
)
{
girara_error
(
"Failed to write to %s"
,
file
);
}
close
(
fd
);
...
...
@@ -782,7 +785,10 @@ plain_io_read(GiraraInputHistoryIO* db)
}
/* read input history file */
file_lock_set
(
fileno
(
file
),
F_RDLCK
);
if
(
file_lock_set
(
fileno
(
file
),
F_RDLCK
)
!=
0
)
{
fclose
(
file
);
return
NULL
;
}
char
*
content
=
girara_file_read2
(
file
);
fclose
(
file
);
...
...
@@ -813,7 +819,10 @@ plain_io_append(GiraraInputHistoryIO* db, const char* input)
}
/* read input history file */
file_lock_set
(
fileno
(
file
),
F_WRLCK
);
if
(
file_lock_set
(
fileno
(
file
),
F_WRLCK
)
!=
0
)
{
fclose
(
file
);
return
;
}
char
*
content
=
girara_file_read2
(
file
);
rewind
(
file
);
...
...
Sebastian Ramacher
@sebastinas
mentioned in issue
#63 (closed)
·
Feb 17, 2019
mentioned in issue
#63 (closed)
mentioned in issue #63
Toggle commit list
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