From a88b0fc413e3a9b70a840e00e05c98e9035e1eaa Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 25 Apr 2016 16:57:35 +1000 Subject: [PATCH] fuser,prtstat: use standard sscanf flag for alloc Previously GNU libc supported the a option in scanf, e.g. %as to allocate the buffer for the scanned string. The manual recommends to use m instead as it follows the standard. --- src/fuser.c | 2 +- src/prtstat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fuser.c b/src/fuser.c index ce8f9db..33bc10f 100644 --- a/src/fuser.c +++ b/src/fuser.c @@ -1565,7 +1565,7 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head) while (fgets(line, BUFSIZ, fp) != NULL) { char *path; char *scanned_path = NULL; - if (sscanf(line, "%*x: %*x %*x %*x %*x %*d %d %as", + if (sscanf(line, "%*x: %*x %*x %*x %*x %*d %d %ms", &scanned_inode, &scanned_path) != 2) { if (scanned_path) free(scanned_path); diff --git a/src/prtstat.c b/src/prtstat.c index fee5f61..2f86799 100644 --- a/src/prtstat.c +++ b/src/prtstat.c @@ -241,7 +241,7 @@ static void print_stat(const int pid, const opt_type options) bptr++; pr = malloc(sizeof(struct proc_info)); sscanf(bptr, - "%a[^)]) " + "%m[^)]) " "%c " "%d %d %d %d %d %d" "%lu %lu %lu %lu " /*flts*/ -- 2.50.1