projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed 2. x-grid example ... since the lable is valid for the whole day, it must be...
[rrdtool.git]
/
src
/
rrd_last.c
diff --git
a/src/rrd_last.c
b/src/rrd_last.c
index
4a32ca3
..
6c2b88c
100644
(file)
--- a/
src/rrd_last.c
+++ b/
src/rrd_last.c
@@
-1,5
+1,5
@@
/*****************************************************************************
/*****************************************************************************
- * RRDtool 1.2
rc2 Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2
.99907080300 Copyright by Tobi Oetiker, 1997-2007
*****************************************************************************
* rrd_last.c
*****************************************************************************
*****************************************************************************
* rrd_last.c
*****************************************************************************
@@
-8,33
+8,32
@@
#include "rrd_tool.h"
#include "rrd_tool.h"
-time_t
-rrd_last(int argc, char **argv)
+time_t rrd_last(
+ int argc,
+ char **argv)
{
{
- if
(argc < 2)
{
+ if
(argc < 2)
{
rrd_set_error("please specify an rrd");
rrd_set_error("please specify an rrd");
- return(-1);
+ return
(-1);
}
}
- return
( rrd_last_r(argv[1])
);
+ return
(rrd_last_r(argv[1])
);
}
}
-
-time_t
-rrd_last_r(const char *filename)
+
+time_t rrd_last_r(
+ const char *filename)
{
{
-
FILE *in_file
;
-
time_t lastup
;
+
time_t lastup = -1
;
+
rrd_file_t *rrd_file
;
- rrd_t
rrd;
+ rrd_t rrd;
- if(rrd_open(filename, &in_file, &rrd, RRD_READONLY)==-1){
- return(-1);
+ rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
+ if (rrd_file != NULL) {
+ lastup = rrd.live_head->last_up;
+ rrd_close(rrd_file);
}
}
- lastup = rrd.live_head->last_up;
rrd_free(&rrd);
rrd_free(&rrd);
- fclose(in_file);
- return(lastup);
+ return (lastup);
}
}
-
-