}
ubus_add_uloop(ctx);
+ if (log_follow && pid_file) {
+ FILE *fp = fopen(pid_file, "w+");
+ if (fp) {
+ fprintf(fp, "%d", getpid());
+ fclose(fp);
+ }
+ }
+
/* ugly ugly ugly ... we need a real reconnect logic */
do {
ret = ubus_lookup_id(ctx, "log", &id);
blobmsg_add_u32(&b, "lines", lines);
else if (log_follow)
blobmsg_add_u32(&b, "lines", 0);
- if (log_follow) {
- if (pid_file) {
- FILE *fp = fopen(pid_file, "w+");
- if (fp) {
- fprintf(fp, "%d", getpid());
- fclose(fp);
- }
- }
- }
if (log_ip && log_port) {
openlog("logread", LOG_PID, LOG_DAEMON);
} while (ret && tries--);
+ if (log_follow && pid_file)
+ unlink(pid_file);
+
return ret;
}