Package: fortune-mod / 1:1.99.1-7

search_LOCFORTDIR_even_if_LANG_not_set.diff Patch series | download
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Description: /usr/local/share/games/fortunes should be searched
 even if locale is not set.
 .
 The source is rather grotty.  I'd really recommend
 stripping out register, auto, and the definitions for true, false, TRUE,
 and FALSE.
 .
 Patch follows:
 .
 It just moves some cases from only checking when locale environment
 variables are set, to always doing them.
Author: Aaron Denney <denney@unm.edu>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=284043

Index: b/fortune/fortune.c
===================================================================
--- a/fortune/fortune.c	2012-07-07 07:00:54.000000000 +0200
+++ b/fortune/fortune.c	2012-07-07 07:00:54.000000000 +0200
@@ -869,6 +869,7 @@
     
     for (i = 0; i < file_cnt; i++)
     {
+        int ret=0;
 	percent = NO_PROB;
 	if (!isdigit(files[i][0]))
 	    sp = files[i];
@@ -940,7 +941,6 @@
 	if (!lang) lang=getenv("LANG");
 	if (lang) {
 	  char llang[512];
-	  int ret=0;
 	  char *p;
 	  
 	  strncpy(llang,lang,sizeof(llang));
@@ -971,27 +971,23 @@
 	    
 	    lang=p;
 	  }
-	  /* default */
-	  if (!ret)
-	    ret=add_file(percent, fullpathname, NULL, &File_list,
+	}
+
+        /* default */
+        if (!ret)
+	  ret=add_file(percent, fullpathname, NULL, &File_list,
 			 &File_tail, NULL);
-	  if ( (!ret && fullpathname != locpathname) || strcmp(sp, "all") == 0 )
-	    ret=add_file(percent, locpathname, NULL, &File_list,
+        if ( (!ret && fullpathname != locpathname) || strcmp(sp, "all") == 0 )
+	  ret=add_file(percent, locpathname, NULL, &File_list,
 		         &File_tail, NULL);
 	  
-	  if (!ret){
-		  snprintf (locpathname, sizeof (locpathname), "%s/%s", getenv ("PWD"), sp);
-		  
-		  ret=add_file (percent, locpathname, NULL, &File_list, &File_tail, NULL);
-	  }
-	  if (!ret)
-	    return FALSE;
-	  
-	}
-	else
-	  if (!add_file(percent, fullpathname, NULL, &File_list,
-			&File_tail, NULL))
-	    return FALSE;
+        if (!ret) {
+          snprintf (locpathname, sizeof (locpathname), "%s/%s", getenv ("PWD"), sp);
+          ret=add_file (percent, locpathname, NULL, &File_list, &File_tail, NULL);
+        }
+
+        if (!ret)
+          return FALSE;
     }
     return TRUE;
 }