1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-03 17:47:28 +03:00

sd-daemon: use path_join() instead of manual path concat

This commit is contained in:
Lennart Poettering 2022-02-14 17:23:35 +01:00
parent c20c77eff8
commit d6b218e742

View File

@ -412,7 +412,7 @@ _public_ int sd_is_mq(int fd, const char *path) {
}
if (path) {
char fpath[PATH_MAX];
_cleanup_free_ char *fpath = NULL;
struct stat a, b;
assert_return(path_is_absolute(path), -EINVAL);
@ -420,8 +420,9 @@ _public_ int sd_is_mq(int fd, const char *path) {
if (fstat(fd, &a) < 0)
return -errno;
strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12);
fpath[sizeof(fpath)-1] = 0;
fpath = path_join("/dev/mqueue", path);
if (!fpath)
return -ENOMEM;
if (stat(fpath, &b) < 0)
return -errno;