Skip to content

Commit

Permalink
pcp-atop: deterministic process sort comparison when handling NULLs
Browse files Browse the repository at this point in the history
  • Loading branch information
natoscott committed Nov 29, 2023
1 parent 402544d commit f198ed7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pcp/atop/showlinux.c
Original file line number Diff line number Diff line change
Expand Up @@ -2564,6 +2564,7 @@ compusr(const void *a, const void *b)
register int uida;
register int uidb;

if (ta == tb) return 0;
if (ta == NULL) return 1;
if (tb == NULL) return -1;

Expand All @@ -2588,6 +2589,7 @@ compnam(const void *a, const void *b)
register char *nama;
register char *namb;

if (ta == tb) return 0;
if (ta == NULL) return 1;
if (tb == NULL) return -1;

Expand All @@ -2606,6 +2608,7 @@ compcon(const void *a, const void *b)
register char *containera;
register char *containerb;

if (ta == tb) return 0;
if (ta == NULL) return 1;
if (tb == NULL) return -1;

Expand Down

0 comments on commit f198ed7

Please sign in to comment.