View | Details | Raw Unified | Return to bug 46673
Collapse All | Expand All

(-)gpasman/files/patch-ab (-23 lines)
Lines 1-23 Link Here
1
--- src/Makefile.in.orig	Fri Sep  3 00:50:10 1999
2
+++ src/Makefile.in	Sat Jul  1 18:19:43 2000
3
@@ -26,9 +26,9 @@
4
 
5
 
6
 CC = @CC@
7
-CFLAGS = @DEFS@ @CFLAGS@ $(shell @GTKCONFIG@ --cflags)
8
+CFLAGS = @DEFS@ @CFLAGS@ `@GTKCONFIG@ --cflags`
9
 LDFLAGS = @LDFLAGS@
10
-LIBS = @LIBS@ $(shell @GTKCONFIG@ --libs)
11
+LIBS = @LIBS@ `@GTKCONFIG@ --libs`
12
 INSTALL = @INSTALL@
13
 
14
 SRCS = librc2.c file.c gpasman.c
15
@@ -39,7 +39,7 @@
16
 	$(CC) -o gpasman $(OBJS) $(LDFLAGS) $(LIBS)
17
 
18
 .c.o: $(SRCS)
19
-	$(CC) -O2 -Wall $(CFLAGS) -c -o $@ $<
20
+	$(CC) $(CFLAGS) -c -o $@ $<
21
 
22
 clean:
23
 	rm -f $(OBJS) gpasman core *~ *.bak
(-)gpasman/files/patch-src::Makefile.in (+23 lines)
Line 0 Link Here
1
--- src/Makefile.in.orig	Fri Sep  3 00:50:10 1999
2
+++ src/Makefile.in	Sat Jul  1 18:19:43 2000
3
@@ -26,9 +26,9 @@
4
 
5
 
6
 CC = @CC@
7
-CFLAGS = @DEFS@ @CFLAGS@ $(shell @GTKCONFIG@ --cflags)
8
+CFLAGS = @DEFS@ @CFLAGS@ `@GTKCONFIG@ --cflags`
9
 LDFLAGS = @LDFLAGS@
10
-LIBS = @LIBS@ $(shell @GTKCONFIG@ --libs)
11
+LIBS = @LIBS@ `@GTKCONFIG@ --libs`
12
 INSTALL = @INSTALL@
13
 
14
 SRCS = librc2.c file.c gpasman.c
15
@@ -39,7 +39,7 @@
16
 	$(CC) -o gpasman $(OBJS) $(LDFLAGS) $(LIBS)
17
 
18
 .c.o: $(SRCS)
19
-	$(CC) -O2 -Wall $(CFLAGS) -c -o $@ $<
20
+	$(CC) $(CFLAGS) -c -o $@ $<
21
 
22
 clean:
23
 	rm -f $(OBJS) gpasman core *~ *.bak
(-)gpasman/files/patch-src::file.c (+51 lines)
Line 0 Link Here
1
--- src/file.c.orig	Mon Dec  2 21:03:36 2002
2
+++ src/file.c	Mon Dec  2 21:33:40 2002
3
@@ -244,9 +244,10 @@
4
    unsigned short ciphertext[4];
5
    int val=0;
6
    unsigned char key[128];
7
+   off_t filesize = LOAD_BUFFER_LENGTH;
8
   
9
    /* first we should check the file permissions */   
10
-   if (file_exists(filename)) {
11
+   if ( (filesize = file_exists(filename)) > 0) {
12
       val = check_file(filename);
13
       if (val != 1) {
14
         return val;
15
@@ -261,7 +262,15 @@
16
       return 0;
17
    }
18
    
19
-   buffer = malloc(LOAD_BUFFER_LENGTH);
20
+   filesize = filesize >= LOAD_BUFFER_LENGTH ? filesize : LOAD_BUFFER_LENGTH;
21
+   buffer = malloc((size_t) filesize);
22
+   if (buffer == NULL) {
23
+#ifdef DEBUG
24
+   fprintf(stderr, "load_init: failed to allocate buffer of size %ld\n", filesize);
25
+#endif   
26
+       return 0;
27
+   }
28
+
29
 #ifdef DEBUGload
30
    fprintf(stderr, "load_init, password=\"%s\"\n", password);
31
 #endif   
32
@@ -440,7 +449,7 @@
33
 }
34
 
35
 
36
-int
37
+off_t
38
 file_exists (char *tfile)
39
 {
40
   struct stat naamstat;
41
@@ -455,8 +464,8 @@
42
   else
43
     {
44
 #ifdef DEBUG
45
-      fprintf (stderr, "file_exists, %s DOES exist\n", tfile);
46
+      fprintf (stderr, "file_exists, %s DOES exist, size is %ld\n", tfile, naamstat.st_size);
47
 #endif
48
-      return (1);
49
+      return (naamstat.st_size);
50
     }
51
 }
(-)gpasman/files/patch-src::file.h (+17 lines)
Line 0 Link Here
1
--- src/file.h.orig	Tue Aug 31 12:32:54 1999
2
+++ src/file.h	Wed Jan  1 21:56:15 2003
3
@@ -7,6 +7,8 @@
4
  * 4 = comment
5
  */
6
 
7
+#include <sys/types.h>
8
+
9
 int save_init(char *filename, char *password);
10
 int save_entry(char *entry[4]);
11
 int save_finalize(void);
12
@@ -14,4 +16,4 @@
13
 int load_entry(char *entry[4]);
14
 int load_finalize(void);
15
 int check_file (char *filename);
16
-int file_exists (char *tfile);
17
+off_t file_exists (char *tfile);
(-)gpasman/files/patch-src::gpasman.c (+20 lines)
Line 0 Link Here
1
--- src/gpasman.c.orig	Mon Dec  2 21:35:13 2002
2
+++ src/gpasman.c	Mon Dec  2 21:36:44 2002
3
@@ -118,7 +118,7 @@
4
    g_print("main, current_set.filename = %s\n", current_set.filename);
5
 #endif
6
    g_free(filename);
7
-   if (file_exists(current_set.filename) == 1) {
8
+   if (file_exists(current_set.filename) > 0) {
9
       load_file(current_set.filename);
10
       gtk_widget_show(main_window);
11
    } else {
12
@@ -612,7 +612,7 @@
13
       return;
14
    }
15
    tmpfilename = return_file();
16
-   if (tmpfilename &&(file_exists(tmpfilename)==1)) {
17
+   if (tmpfilename &&(file_exists(tmpfilename)>0)) {
18
       file_clear(w, data);
19
       current_set.filename = g_malloc(strlen(tmpfilename)+1);
20
       strcpy(current_set.filename, tmpfilename);

Return to bug 46673