NETWAYS / check_system_basics

A Monitoring Plugin to test various basic operating system properties (on Linux for now)
GNU General Public License v2.0
6 stars 1 forks source link

Don't try to derefence disk.usage pointer in error case #29

Closed RincewindsHat closed 7 months ago

RincewindsHat commented 7 months ago

This fixes an error when a filesystem is mounted below a directory for which the user, which executes the plugin, does not have read permissions. In that scenario, the code tried to dereference a pointer without checking whether diskUsage returned an error.

In the case of an error, this pointer is nil and was dereferenced, which caused a panic.

This commit checks whether an error occured and does no try to access the pointer, if there is an error.