brewco/rdconfig.c

changeset 465
3aac3276689d
parent 464
4a624c071ca9
child 473
fdd30e935079
--- a/brewco/rdconfig.c	Sun Dec 20 20:37:40 2015 +0100
+++ b/brewco/rdconfig.c	Sun Dec 20 20:52:37 2015 +0100
@@ -1284,12 +1284,12 @@
     /*
      * Make upto 10 backups of the configuration.
      */
-    fpath = calloc(1024, sizeof(char));
-    tpath = calloc(1024, sizeof(char));
+    fpath = calloc(PATH_MAX, sizeof(char));
+    tpath = calloc(PATH_MAX, sizeof(char));
 
     for (i = 9; i > 0; i--) {
-	snprintf(tpath, 1023, "%s.%d", mypath, i+1);
-	snprintf(fpath, 1023, "%s.%d", mypath, i);
+	snprintf(tpath, PATH_MAX, "%s.%d", mypath, i+1);
+	snprintf(fpath, PATH_MAX, "%s.%d", mypath, i);
 	if (file_exist(fpath, R_OK) == 0) {
 	    unlink(tpath);
 	    if (file_cp(fpath, tpath)) {
@@ -1297,8 +1297,8 @@
 	    }
 	}
     }
-    snprintf(tpath, 1023, "%s.1", mypath);
-    snprintf(fpath, 1023, "%s", mypath);
+    snprintf(tpath, PATH_MAX, "%s.1", mypath);
+    snprintf(fpath, PATH_MAX, "%s", mypath);
     if (file_exist(fpath, R_OK) == 0) {
     	unlink(tpath);
     	if (file_cp(fpath, tpath)) {

mercurial