From: Jean-Philippe Orsini Date: Fri, 19 Sep 2014 07:23:21 +0000 (+0200) Subject: normalize and cleanup X-Git-Tag: v1.1.2~44 X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=commitdiff_plain;h=6c2baf022eaf6eef8fe3e94162e54e5a27f76d6d normalize and cleanup --- diff --git a/src/lib/hdd_atasmart.c b/src/lib/hdd_atasmart.c index b34564e..7920d93 100644 --- a/src/lib/hdd_atasmart.c +++ b/src/lib/hdd_atasmart.c @@ -39,6 +39,8 @@ #include #include +static const char *PROVIDER_NAME = "atasmart"; + static int filter_sd(const char *p) { return strlen(p) == 8 && !strncmp(p, "/dev/sd", 7); @@ -133,9 +135,11 @@ struct psensor **hdd_psensor_list_add(struct psensor **sensors, log_debug("hdd_psensor_list_add(hdd_atasmart) open %s", *tmp); if (!sk_disk_open(*tmp, &disk)) { - id = malloc(strlen("atasmart ") + strlen(*tmp) + 1); - strcpy(id, "atasmart "); - strcat(id, *tmp); + id = malloc(strlen(PROVIDER_NAME) + + 1 + + strlen(*tmp) + + 1); + sprintf(id, "%s %s", PROVIDER_NAME, *tmp); sensor = create_sensor(id, *tmp,