aboutsummaryrefslogtreecommitdiffstats
path: root/src/modbuslog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modbuslog.c')
-rw-r--r--src/modbuslog.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/modbuslog.c b/src/modbuslog.c
index e7ccb05..1e849bb 100644
--- a/src/modbuslog.c
+++ b/src/modbuslog.c
@@ -309,7 +309,12 @@ int main(int argc, char *argv[]) {
int intervalid;
FILE *intervalfile = fopen("/var/modbuslog/interval/interval.txt", "r+");
fscanf(intervalfile, "%d", &intervalid);
- intervalid++;
+ //handle 32bit signed overflow
+ if(intervalid==2147483647){
+ intervalid=0;
+ }else{
+ intervalid++;
+ }
rewind(intervalfile);
fprintf(intervalfile, "%d", intervalid);
fclose(intervalfile);
lspan='5' class='logmsg'> `nyancat -esnf 1` will (quite nicely) display a single frame and then terminate, in a matter that is perfect for generate MOTDs. `nyancat -esnf 10` (for example) will run through the animation (though it may not work perfectly, depending on the size of your terminal and various other things) 2012-03-26Remove debug output that I completely forgot aboutKevin Lange1-2/+0 2012-03-25Added extra display optionsKevin Lange2-38/+124 2012-03-23(style)Kevin Lange1-3/+9 2012-03-23Add install targetKevin Lange1-1/+4 2012-03-23Command line options with getopt_longKevin Lange1-148/+196 2012-03-22Change package version systemJonathan McCrohan1-1/+1 ver+date.ref-packageversion 2012-03-19include ctype.h for tolower()Tay Ray Chuan1-0/+1 2012-03-19provide struct winsize and TIOCGWINSZ on SolarisTay Ray Chuan1-0/+7 2012-03-18Remove more dh_make autogenerated filesJonathan McCrohan4-22/+0 2012-03-08Update myanpageJonathan McCrohan1-19/+4