Browse code

Make postnumber start on 1

Dario Rodriguez authored on 09/07/2014 11:11:48
Showing 1 changed files
... ...
@@ -35,6 +35,8 @@ post_new(kakumei *ka, char *user, char *title, char *text)
35 35
                 return(-1);
36 36
         }
37 37
         last=post_last(ka);
38
+	if(last==-1)
39
+		last=0; /* post number starts on 1 (last+1)*/
38 40
         filename[0]='\0';
39 41
         for(num=last+1;num<MAXPOSTS;num++) {
40 42
                 snprintf(filename,sizeof(filename),"%s/%04i/%04i.json",POSTSDIR,num/10000,num%10000);