Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit ccbfc5a

Browse files
authored
Merge pull request #312 from laijs/sprintf-309
fix sprintf warming
2 parents d1187bb + 744eec8 commit ccbfc5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ void online_cpu(void)
511511
ret = sscanf(entry->d_name, "cpu%d", &num);
512512
if (ret < 1 || num == 0) /* skip none cpu%d and cpu0 */
513513
continue;
514-
sprintf(path, "/sys/devices/system/cpu/%s/online", entry->d_name);
514+
sprintf(path, "/sys/devices/system/cpu/cpu%d/online", num);
515515
fd = open(path, O_RDWR);
516516
if (fd < 0) {
517517
fprintf(stderr, "open %s failed\n", path);
@@ -547,7 +547,7 @@ void online_memory(void)
547547
ret = sscanf(entry->d_name, "memory%d", &num);
548548
if (ret < 1 || num == 0) /* skip none memory%d and memory0 */
549549
continue;
550-
sprintf(path, "/sys/devices/system/memory/%s/online", entry->d_name);
550+
sprintf(path, "/sys/devices/system/memory/memory%d/online", num);
551551
fd = open(path, O_RDWR);
552552
if (fd < 0) {
553553
fprintf(stderr, "open %s failed\n", path);

0 commit comments

Comments
 (0)