diff options
author | Andrew Waterman <waterman@eecs.berkeley.edu> | 2014-06-12 15:29:30 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@eecs.berkeley.edu> | 2014-06-12 15:29:30 -0700 |
commit | 2934c5a65f85876f056edcd3a8c8ea3e7a8c442e (patch) | |
tree | 69ef1b7cd7ea6c360ef57d3df9bf64eabd5a72f7 /pk | |
parent | 053aa8ff8006427abe89afc0df944a201d424af2 (diff) | |
download | pk-2934c5a65f85876f056edcd3a8c8ea3e7a8c442e.zip pk-2934c5a65f85876f056edcd3a8c8ea3e7a8c442e.tar.gz pk-2934c5a65f85876f056edcd3a8c8ea3e7a8c442e.tar.bz2 |
Add file reference counting sanity check
Diffstat (limited to 'pk')
-rw-r--r-- | pk/file.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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) |