From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx> Re-add backward compatibility which got lost in 058e8154. Initializing unknown struct members to 0xdead is similar to the fallback. For upward compatibility ignore columns > 16 but not the whole line (in case the kernel would add more columns in future). Reported-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx> --- sys-utils/ipcutils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c index c763cde..349e855 100644 --- a/sys-utils/ipcutils.c +++ b/sys-utils/ipcutils.c @@ -113,6 +113,9 @@ int ipc_shm_get_info(int id, struct shm_data **shmds) while (fgetc(f) != '\n'); /* skip header */ while (fgets(buf, sizeof(buf), f) != NULL) { + /* scan for the first 14-16 columns (e.g. Linux 2.6.32 has 14) */ + p->shm_rss = 0xdead; + p->shm_swp = 0xdead; if (sscanf(buf, "%d %d %o %"SCNu64 " %u %u " "%"SCNu64 " %u %u %u %u %"SCNi64 " %"SCNi64 " %"SCNi64 @@ -132,7 +135,7 @@ int ipc_shm_get_info(int id, struct shm_data **shmds) &p->shm_dtim, &p->shm_ctim, &p->shm_rss, - &p->shm_swp) != 16) + &p->shm_swp) < 14) continue; /* ivalid line, skipped */ if (id > -1) { -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html