ports/61479: [patch] fix for uptimed

Radim Kolar hsn at netmag.cz
Sat Jan 17 16:40:22 UTC 2004


>Number:         61479
>Category:       ports
>Synopsis:       [patch] fix for uptimed
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 17 08:40:16 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Radim Kolar
>Release:        FreeBSD 5.2-RELEASE i386
>Organization:
Sanatana Dharma
>Environment:
System: FreeBSD asura.bsd 5.2-RELEASE FreeBSD 5.2-RELEASE #0: Thu Jan 15 18:35:03 CET 2004 root at asura.bsd:/usr/obj/usr/src/sys/GENERIC i386
>Description:
When system crashes while uptimed is updating his record file, all entries
in the file are lost. This simple patch writes records into temporary
file and rename it to original. Tested and works.
>How-To-Repeat:
Press reset button while uptimed is running, if you are lucky, softupdates
sets file length to zero. It happens to me 2 times on linux with 
reiserfs journaling and 3 times 
on freebsd with softupdates.
>Fix:
diff -rNu /usr/ports/sysutils/uptimed/Makefile /tmp/uptimed/Makefile
--- /usr/ports/sysutils/uptimed/Makefile	Fri Feb 21 14:28:55 2003
+++ /tmp/uptimed/Makefile	Fri Jan 16 22:40:59 2004
@@ -6,6 +6,7 @@
 
 PORTNAME=	uptimed
 PORTVERSION=	0.3.0
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	uptimed
diff -rNu /usr/ports/sysutils/uptimed/files/patch-aa /tmp/uptimed/files/patch-aa
--- /usr/ports/sysutils/uptimed/files/patch-aa	Thu Jan  1 01:00:00 1970
+++ /tmp/uptimed/files/patch-aa	Fri Jan 16 22:43:09 2004
@@ -0,0 +1,19 @@
+--- libuptimed/urec.c.orig	Tue Nov  5 12:41:04 2002
++++ libuptimed/urec.c	Fri Jan 16 22:42:30 2004
+@@ -246,7 +246,7 @@
+ 	Urec *u;
+ 	int i=0;
+ 	
+-	f=fopen(FILE_RECORDS, "w");
++	f=fopen(FILE_RECORDS".new", "w");
+ 	if (!f)
+ 	{
+ 		printf("uptimed: cannot write to %s\n", FILE_RECORDS);
+@@ -265,6 +265,7 @@
+ 		}
+ 	}
+ 	fclose(f);
++	rename(FILE_RECORDS".new",FILE_RECORDS);
+ }
+ 
+ #ifdef PLATFORM_LINUX
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list