aboutsummaryrefslogtreecommitdiff
path: root/pk/file.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@eecs.berkeley.edu>2014-06-12 15:29:30 -0700
committerAndrew Waterman <waterman@eecs.berkeley.edu>2014-06-12 15:29:30 -0700
commit2934c5a65f85876f056edcd3a8c8ea3e7a8c442e (patch)
tree69ef1b7cd7ea6c360ef57d3df9bf64eabd5a72f7 /pk/file.c
parent053aa8ff8006427abe89afc0df944a201d424af2 (diff)
downloadpk-2934c5a65f85876f056edcd3a8c8ea3e7a8c442e.zip
pk-2934c5a65f85876f056edcd3a8c8ea3e7a8c442e.tar.gz
pk-2934c5a65f85876f056edcd3a8c8ea3e7a8c442e.tar.bz2
Add file reference counting sanity check
Diffstat (limited to 'pk/file.c')
-rw-r--r--pk/file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pk/file.c b/pk/file.c
index b6847aa..e2510d8 100644
--- a/pk/file.c
+++ b/pk/file.c
@@ -15,7 +15,8 @@ file_t *stdout, *stdin, *stderr;
void file_incref(file_t* f)
{
- atomic_add(&f->refcnt, 1);
+ long prev = atomic_add(&f->refcnt, 1);
+ kassert(prev > 0);
}
void file_decref(file_t* f)