File 02-current-symlink.patch of Package udplogger

Provide a symlink "current" to the most recent logfile.

--- udplogger-1.1/udplogger.c.orig	2015-03-30 12:13:02.108848805 +0200
+++ udplogger-1.1/udplogger.c	2015-03-30 12:25:07.723670333 +0200
@@ -88,6 +88,7 @@ static void switch_logfile(struct tm *tm
 	FILE *fp;
 	int fd;
 	struct stat buf;
+	static char curfilename[] = "current.log";
 	snprintf(filename, sizeof(filename) - 1, "%04u-%02u.log",
 		 tm->tm_year + 1900, tm->tm_mon + 1);
 	/*
@@ -108,7 +109,9 @@ static void switch_logfile(struct tm *tm
 		goto out1;
 	if (log_fp)
 		fclose(log_fp);
+	unlink(curfilename);
 	log_fp = fp;
+	link(filename,curfilename); /* We can ignore errors here. */
 	try_drop_memory_usage = 1;
 	return;
  out2:
openSUSE Build Service is sponsored by