From: Craig Small Date: Mon, 25 Apr 2016 06:57:35 +0000 (+1000) Subject: fuser,prtstat: use standard sscanf flag for alloc X-Git-Tag: v23.0rc1~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a88b0fc413e3a9b70a840e00e05c98e9035e1eaa;p=psmisc 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. --- 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*/