summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4ca1117)
git-svn-id: http://svn.planet-lab.org/svn/fprobe-ulog/trunk@6931
8c455092-636d-4788-adf5-
e71def0336e8
fd = open("/tmp/fprobe_last_epoch",O_RDONLY);
if (fd != -1) {
char snum[7];
fd = open("/tmp/fprobe_last_epoch",O_RDONLY);
if (fd != -1) {
char snum[7];
- read(fd, snum, 7);
- sscanf(snum,"%d",&cur_epoch);
+ ssize_t len;
+ len = read(fd, snum, sizeof(snum)-1);
+ if (len != -1) {
+ snum[len]='\0';
+ sscanf(snum,"%d",&cur_epoch);
+ close(fd);
+ }