Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102058365
D41379.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41379.diff
View Options
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -130,6 +130,7 @@
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
+#include <libgen.h>
#include <libutil.h>
#include <limits.h>
#include <netdb.h>
@@ -198,7 +199,8 @@
#define sl_salen sl_ai.ai_addrlen
#define sl_family sl_ai.ai_family
int sl_socket;
- const char *sl_name;
+ char *sl_name;
+ int sl_dirfd;
int (*sl_recv)(struct socklist *);
STAILQ_ENTRY(socklist) next;
};
@@ -2341,8 +2343,12 @@
logerror(buf);
}
STAILQ_FOREACH(sl, &shead, next) {
- if (sl->sl_sa != NULL && sl->sl_family == AF_LOCAL)
- unlink(sl->sl_name);
+ if (sl->sl_sa != NULL && sl->sl_family == AF_LOCAL) {
+ if (unlinkat(sl->sl_dirfd, sl->sl_name, 0) == -1) {
+ dprintf("Failed to unlink %s: %s", sl->sl_name,
+ strerror(errno));
+ }
+ }
}
pidfile_remove(pfh);
@@ -3782,7 +3788,16 @@
if (sl == NULL)
err(1, "malloc failed");
sl->sl_socket = s;
- sl->sl_name = name;
+ if (ai->ai_family == AF_LOCAL) {
+ char *name2 = strdup(name);
+ if (name2 == NULL)
+ err(1, "strdup failed");
+ sl->sl_name = strdup(basename(name2));
+ sl->sl_dirfd = open(dirname(name2), O_DIRECTORY);
+ if (sl->sl_name == NULL || sl->sl_dirfd == -1)
+ err(1, "failed to save dir info for %s", name);
+ free(name2);
+ }
sl->sl_recv = sl_recv;
(void)memcpy(&sl->sl_ai, ai, sizeof(*ai));
if (ai->ai_addrlen > 0) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 2:36 AM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14525875
Default Alt Text
D41379.diff (1 KB)
Attached To
Mode
D41379: syslogd: unlink() -> unlinkat()
Attached
Detach File
Event Timeline
Log In to Comment