diff options
Diffstat (limited to 'lib/libkvm/kvm.c')
-rw-r--r-- | lib/libkvm/kvm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 9e97a78..1bea13c 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -179,6 +179,11 @@ _kvm_open(kd, uf, mf, flag, errout) _kvm_syserr(kd, kd->program, "%s", mf); goto failed; } + if (S_ISREG(st.st_mode) && st.st_size <= 0) { + errno = EINVAL; + _kvm_syserr(kd, kd->program, "empty file"); + goto failed; + } if (fcntl(kd->pmfd, F_SETFD, FD_CLOEXEC) < 0) { _kvm_syserr(kd, kd->program, "%s", mf); goto failed; |