chiark
/
gitweb
/
~bjharris
/
clunk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0b03b7d
)
With "-s" specified, cope with empty or missing state file.
author
Ben Harris
<bjh21@bjh21.me.uk>
Wed, 14 Nov 2018 00:26:35 +0000
(
00:26
+0000)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Wed, 14 Nov 2018 00:26:35 +0000
(
00:26
+0000)
clunk.c
patch
|
blob
|
history
diff --git
a/clunk.c
b/clunk.c
index cbb8efb33f4cb6b660b81cfab543c01d90d43d2a..2ff3b4447b19c073e3342a8791db75c249aedbfd 100644
(file)
--- a/
clunk.c
+++ b/
clunk.c
@@
-100,8
+100,10
@@
init_statefile(char const *statefilename)
len = pread(statefd, buf, 9, 0);
if (len == -1)
err(1, "read %s", optarg);
- buf[len] = '\0';
- init_statestring(buf);
+ if (len > 0) {
+ buf[len] = '\0';
+ init_statestring(buf);
+ }
}
static void