diff options
author | infirit <[email protected]> | 2015-07-03 18:41:53 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2015-07-07 15:36:36 +0200 |
commit | e688080690005e5508db95d5f19c351c457302de (patch) | |
tree | 19c25832c942a75a05da44255a19829bf2d70b5b | |
parent | a9fe9c4239c98f08a8815985cbcc485d729b0c2c (diff) | |
download | mate-sensors-applet-e688080690005e5508db95d5f19c351c457302de.tar.bz2 mate-sensors-applet-e688080690005e5508db95d5f19c351c457302de.tar.xz |
hddtemp: use g_strcmp0 instead of strcmp
Passing NULL to strcmp could be unsafe or at the minimum
result in undefined behaviour. g_strcmp0 handles NULL
gracefully and returns 0.
-rw-r--r-- | plugins/hddtemp/hddtemp-plugin.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/hddtemp/hddtemp-plugin.c b/plugins/hddtemp/hddtemp-plugin.c index 220c830..f7d36f5 100644 --- a/plugins/hddtemp/hddtemp-plugin.c +++ b/plugins/hddtemp/hddtemp-plugin.c @@ -151,9 +151,9 @@ static void hddtemp_plugin_get_sensors(GList **sensors) { pv = output_vector = g_strsplit(hddtemp_output, "|", -1); while(pv[1] != NULL) { - if (strcmp(pv[2], "") != 0 && - strcmp(pv[3], "") != 0 && - strcmp(pv[4], "") != 0 && + if (g_strcmp0(pv[2], "") != 0 && + g_strcmp0(pv[3], "") != 0 && + g_strcmp0(pv[4], "") != 0 && (!(g_ascii_strcasecmp(pv[2], "???") == 0 || g_ascii_strcasecmp(pv[3], "ERR") == 0 || g_ascii_strcasecmp(pv[4], "*") == 0))) { |