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
|
From: Robert Schwebel <r.schwebel@pengutronix.de>
Date: Sat, 29 Oct 2011 19:13:38 +0200
Subject: [PATCH] add nullpointer check
Patch taken from redhat.
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
---
efax.c | 1 +
efaxos.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/efax.c b/efax.c
index bdcd462..28f7fca 100644
--- a/efax.c
+++ b/efax.c
@@ -2186,6 +2186,7 @@ int main( int argc, char **argv)
/* print initial message to both stderr & stdout */
argv0 = argv[0] ;
+ memset((void *)lkfile, 0, sizeof(lkfile)); /* random effects on sparc linux */
verb[1] = "ewia" ;
msg ( "I " Version " " Copyright ) ;
argv0 = efaxbasename ( argv0 ) ;
diff --git a/efaxos.c b/efaxos.c
index 6b346d6..dc3ae33 100644
--- a/efaxos.c
+++ b/efaxos.c
@@ -482,7 +482,7 @@ int lockall ( char **lkfiles, int log )
{
int err = 0 ;
char **p = lkfiles ;
- while ( *p && ! err )
+ while ( *p && **p && ! err )
if ( ( err = ttlock ( *p++, log ) ) == 3 ) err = 0 ;
return err ;
}
@@ -495,7 +495,7 @@ int unlockall ( char **lkfiles )
{
int err = 0, i ;
char **p = lkfiles ;
- while ( *p )
+ while ( *p && **p )
if ( ( i = ttunlock ( *p++ ) ) != 0 ) err = i ;
return err ;
}
|