diff options
author | bhackerozzo <bhackerozzo@3b445381-d045-0410-9223-e17ecdb95f4b> | 2010-08-19 03:38:07 +0000 |
---|---|---|
committer | bhackerozzo <bhackerozzo@3b445381-d045-0410-9223-e17ecdb95f4b> | 2010-08-19 03:38:07 +0000 |
commit | 208355640d0ef6916d9a62a5686e41a3129e406b (patch) | |
tree | a841ad56bdeba4cf1f5fbd8a436beb506ef2a600 | |
parent | bc6949c9e6446cb5de4581dacc730676ff4c6d50 (diff) | |
download | cpulimit-208355640d0ef6916d9a62a5686e41a3129e406b.tar.gz |
Segmentation fault fixed (thanks to kroody)
-rw-r--r-- | procutils.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/procutils.c b/procutils.c index edf6139..83f3e58 100644 --- a/procutils.c +++ b/procutils.c @@ -224,6 +224,7 @@ int read_next_process(struct process_iterator *i) { char statfile[20]; sprintf(statfile,"/proc/%d/cmdline",pid); FILE *fd = fopen(statfile, "r"); + if (fd == NULL) return -1; char buffer[1024]; if (fgets(buffer, sizeof(buffer), fd)==NULL) return -2; fclose(fd); |