now it rename() files instead of link()/unlink() them, thus making sure there will be always a JSON file to show.
now it rename() files instead of link()/unlink() them, thus making sure there will be always a JSON file to show.
box@home root committed
Jun 21, 2013 at 00:05 UTC
604f9f48cd7013df5dd55435ec288ebf5ae7623c
1 file changed
+6
-3
netdata.c
+6
-3
@@ -138,9 +138,12 @@ void save_proc_net_dev() {
138
}
139
fprintf(fp, " ]\n}\n");
140
fclose(fp);
141
- unlink(filename);
142
- r = link(tmp, filename);
143
- unlink(tmp);
141
+
142
+ r = rename(tmp, filename);
143
+ if(r == -1) perror("Cannot rename JSON file.");
144
+ //unlink(filename);
145
+ //r = link(tmp, filename);
146
+ //unlink(tmp);
147
}
148
}
149