forked from soccera/rdo
Remove debug printf & use strlen() at write
In sessions.h, now line 95, we used sizeof(ts_str) to determine how much to write, but as ts_str can be longer than the actual string written, it wrote random data after the actual timestamp.
This commit is contained in:
parent
24638bc999
commit
c80be89ef9
1 changed files with 1 additions and 2 deletions
|
@ -92,7 +92,7 @@ void setsession(int pid, unsigned int ts_ttl) {
|
|||
|
||||
snprintf(ts_str, sizeof(ts_str), "%llu", (unsigned long long)time(NULL));
|
||||
|
||||
if (write(fd, ts_str, sizeof(ts_str)) < 0)
|
||||
if (write(fd, ts_str, strlen(ts_str)) < 0)
|
||||
err(1, "Could not write to %s", path);
|
||||
|
||||
close(fd);
|
||||
|
@ -123,7 +123,6 @@ int getsession(int pid, unsigned int ts_ttl) {
|
|||
err(1, "Could not open %s", path);
|
||||
}
|
||||
|
||||
printf("%d", fd);
|
||||
if (read(fd, ts_str, sizeof(ts_str)) < 0)
|
||||
err(1, "Could not read %s", path);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue