summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2020-08-19 00:00:00 -0500
committerCraig Small <csmall@dropbear.xyz>2020-08-24 21:37:52 +1000
commit81db6664c92ca54c5274b17666e2724527a22326 (patch)
tree88809a2de0759eb4713cda8f4ae9958af7dd8531
parent0cddb06425f98ff78b352500cfbc15129e79b09f (diff)
downloadprocps-ng-81db6664c92ca54c5274b17666e2724527a22326.tar.gz
library: fix a flaw in one 'new' function, <diskstats>
At 'new' time, the major API modules each ensure their 'info' parameter isn't NULL but what it pointed to was except this single straggler, for some unknown reason. So, this patch brings him into line with those others. [ And, without going into the ugly details, this was ] [ the reason I never experienced an abend originally ] [ but Craig did. And, though related to stacks mgmt, ] [ zero initialization was not a factor. Anyway, with ] [ this patch, everybody would have experienced abend ] [ under the original (faulty) test_Itemtables logic! ] Reference(s): https://www.freelists.org/post/procps/keep-on-patchin,13 Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r--proc/diskstats.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/proc/diskstats.c b/proc/diskstats.c
index 3f9ff7c..0fb5d58 100644
--- a/proc/diskstats.c
+++ b/proc/diskstats.c
@@ -733,7 +733,7 @@ PROCPS_EXPORT int procps_diskstats_new (
if (failed) _Exit(EXIT_FAILURE);
#endif
- if (info == NULL)
+ if (info == NULL || *info != NULL)
return -EINVAL;
if (!(p = calloc(1, sizeof(struct diskstats_info))))
return -ENOMEM;