fs-util: let's avoid unnecessary strerror()
strerror() is not thread safe. Let's avoid it where it is easy hence.
(Ideally we'd not use it at all anymore, but that's sometimes a bit
nasty, not in this case though, where it is very easy to avoid)
Follow-up for: 27c3112dcb
This commit is contained in:
parent
8574039520
commit
fe573a798d
|
@ -662,15 +662,12 @@ int inotify_add_watch_fd(int fd, int what, uint32_t mask) {
|
|||
}
|
||||
|
||||
int inotify_add_watch_and_warn(int fd, const char *pathname, uint32_t mask) {
|
||||
|
||||
if (inotify_add_watch(fd, pathname, mask) < 0) {
|
||||
const char *reason;
|
||||
|
||||
if (errno == ENOSPC)
|
||||
reason = "inotify watch limit reached";
|
||||
else
|
||||
reason = strerror_safe(errno);
|
||||
return log_error_errno(errno, "Failed to add a watch for %s: inotify watch limit reached", pathname);
|
||||
|
||||
return log_error_errno(errno, "Failed to add a watch for %s: %s", pathname, reason);
|
||||
return log_error_errno(errno, "Failed to add a watch for %s: %m", pathname);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue