Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
d2a8b1e8
Commit
d2a8b1e8
authored
3 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/InotifySource: make errors non-fatal
parent
184e8eca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
InotifySource.cxx
src/db/update/InotifySource.cxx
+13
-6
No files found.
src/db/update/InotifySource.cxx
View file @
d2a8b1e8
...
...
@@ -20,7 +20,6 @@
#include "InotifySource.hxx"
#include "InotifyDomain.hxx"
#include "io/FileDescriptor.hxx"
#include "system/FatalError.hxx"
#include "system/Error.hxx"
#include "Log.hxx"
...
...
@@ -39,10 +38,17 @@ InotifySource::OnSocketReady([[maybe_unused]] unsigned flags) noexcept
auto
ifd
=
socket_event
.
GetFileDescriptor
();
ssize_t
nbytes
=
ifd
.
Read
(
buffer
,
sizeof
(
buffer
));
if
(
nbytes
<
0
)
FatalSystemError
(
"Failed to read from inotify"
);
if
(
nbytes
==
0
)
FatalError
(
"end of file from inotify"
);
if
(
nbytes
<=
0
)
{
if
(
nbytes
<
0
)
FmtError
(
inotify_domain
,
"Failed to read from inotify: {}"
,
strerror
(
errno
));
else
LogError
(
inotify_domain
,
"end of file from inotify"
);
socket_event
.
Cancel
();
return
;
}
const
uint8_t
*
p
=
buffer
,
*
const
end
=
p
+
nbytes
;
...
...
@@ -101,7 +107,8 @@ InotifySource::Remove(unsigned wd) noexcept
auto
ifd
=
socket_event
.
GetFileDescriptor
();
int
ret
=
inotify_rm_watch
(
ifd
.
Get
(),
wd
);
if
(
ret
<
0
&&
errno
!=
EINVAL
)
LogErrno
(
inotify_domain
,
"inotify_rm_watch() has failed"
);
FmtError
(
inotify_domain
,
"inotify_rm_watch() has failed: {}"
,
strerror
(
errno
));
/* EINVAL may happen here when the file has been deleted; the
kernel seems to auto-unregister deleted files */
...
...
This diff is collapsed.
Click to expand it.
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