summaryrefslogtreecommitdiff
path: root/sysutils/upsd/files/patch-misc.c
blob: 39abcc43c05a4f3fc077b4b01a5ba8446818129a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- misc.c.orig	Sat Aug  3 01:44:24 1996
+++ misc.c	Mon Dec 18 21:03:19 2006
@@ -27,7 +27,7 @@
 		    pathname);
 		return -1;
 	}
-	fprintf(f, "%ld\n", getpid());
+	fprintf(f, "%u\n", getpid());
 	fclose(f);
 	umask(oldmask);
 	return 0;
@@ -60,7 +60,7 @@
 {
 	register char *p;
 	if((p = malloc(size)) == NULL) {
-		syslog(LOG_ERR, "xalloc: cannot allocate %ls bytes: %m", size);
+		syslog(LOG_ERR, "xalloc: cannot allocate %u bytes: %m", size);
 		return NULL;
 	}
 	return p;
@@ -105,7 +105,7 @@
 		if(((struct ident *)list)->id == 0) {
 			return NULL;
 		}
-		(char *)list += size;
+		list += size;
 	}
 	return list;
 }
@@ -122,7 +122,7 @@
 	register void *list;
 	register size_t size;
 {
-	for(;((struct ident *)list)->id != 0;(char *)list += size) {
+	for(;((struct ident *)list)->id != 0;list += size) {
 		if(((struct ident *)list)->name == name) {
 			return list;
 		}
@@ -255,7 +255,7 @@
 int
 getcurrenttime(void)
 {
-	if(time(&current_time) == NULL) {
+	if(time(&current_time) == -1) {
 		syslog(LOG_ERR, "cannot get current time: %m");
 		return -1;
 	}