io, net, evnet: quote file names in error messages

This commit is contained in:
Max Kellermann 2024-04-05 14:21:24 +02:00 committed by Max Kellermann
parent b3a31b69ee
commit 1e4bf90c60
3 changed files with 10 additions and 10 deletions

View File

@ -46,7 +46,7 @@ InotifyEvent::AddWatch(const char *pathname, uint32_t mask)
{ {
int wd = TryAddWatch(pathname, mask); int wd = TryAddWatch(pathname, mask);
if (wd < 0) if (wd < 0)
throw FmtErrno("inotify_add_watch('{}') failed", pathname); throw FmtErrno("inotify_add_watch({:?}) failed", pathname);
return wd; return wd;
} }

View File

@ -12,7 +12,7 @@ OpenReadOnly(const char *path, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.Open(path, O_RDONLY|flags)) if (!fd.Open(path, O_RDONLY|flags))
throw FmtErrno("Failed to open '{}'", path); throw FmtErrno("Failed to open {:?}", path);
return fd; return fd;
} }
@ -22,7 +22,7 @@ OpenWriteOnly(const char *path, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.Open(path, O_WRONLY|flags)) if (!fd.Open(path, O_WRONLY|flags))
throw FmtErrno("Failed to open '{}'", path); throw FmtErrno("Failed to open {:?}", path);
return fd; return fd;
} }
@ -34,7 +34,7 @@ OpenDirectory(const char *path, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.Open(path, O_DIRECTORY|O_RDONLY|flags)) if (!fd.Open(path, O_DIRECTORY|O_RDONLY|flags))
throw FmtErrno("Failed to open '{}'", path); throw FmtErrno("Failed to open {:?}", path);
return fd; return fd;
} }
@ -48,7 +48,7 @@ OpenPath(const char *path, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.Open(path, O_PATH|flags)) if (!fd.Open(path, O_PATH|flags))
throw FmtErrno("Failed to open '{}'", path); throw FmtErrno("Failed to open {:?}", path);
return fd; return fd;
} }
@ -58,7 +58,7 @@ OpenPath(FileDescriptor directory, const char *name, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.Open(directory, name, O_PATH|flags)) if (!fd.Open(directory, name, O_PATH|flags))
throw FmtErrno("Failed to open '{}'", name); throw FmtErrno("Failed to open {:?}", name);
return fd; return fd;
} }
@ -68,7 +68,7 @@ OpenReadOnly(FileDescriptor directory, const char *name, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.Open(directory, name, O_RDONLY|flags)) if (!fd.Open(directory, name, O_RDONLY|flags))
throw FmtErrno("Failed to open '{}'", name); throw FmtErrno("Failed to open {:?}", name);
return fd; return fd;
} }
@ -78,7 +78,7 @@ OpenWriteOnly(FileDescriptor directory, const char *name, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.Open(directory, name, O_WRONLY|flags)) if (!fd.Open(directory, name, O_WRONLY|flags))
throw FmtErrno("Failed to open '{}'", name); throw FmtErrno("Failed to open {:?}", name);
return fd; return fd;
} }
@ -88,7 +88,7 @@ OpenDirectory(FileDescriptor directory, const char *name, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.Open(directory, name, O_DIRECTORY|O_RDONLY|flags)) if (!fd.Open(directory, name, O_DIRECTORY|O_RDONLY|flags))
throw FmtErrno("Failed to open '{}'", name); throw FmtErrno("Failed to open {:?}", name);
return fd; return fd;
} }

View File

@ -32,7 +32,7 @@ Resolve(const char *node, const char *service,
#else #else
const char *msg = gai_strerror(error); const char *msg = gai_strerror(error);
#endif #endif
throw FmtRuntimeError("Failed to resolve '{}':'{}': {}", throw FmtRuntimeError("Failed to resolve {:?}:{:?}: {}",
node == nullptr ? "" : node, node == nullptr ? "" : node,
service == nullptr ? "" : service, service == nullptr ? "" : service,
msg); msg);