All of lore.kernel.org
 help / color / mirror / Atom feed
From: yumkam@gmail.com (Yuriy M. Kaminskiy)
To: util-linux@vger.kernel.org
Subject: [PATCH] lscpu: fix backward buffer size adjustment after adding delimiter
Date: Sat, 27 Feb 2016 18:00:50 +0300	[thread overview]
Message-ID: <m3r3fymc4d.fsf@gmail.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/x-diff, Size: 937 bytes --]

>From dfa883887123b5dd0f4230ae4aadd178bb49f4e5 Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Date: Sat, 27 Feb 2016 17:55:07 +0300
Subject: [PATCH] lscpu: fix backward size buffer adjustment after adding
 delimiter

remaining buffer space was increased after adding character, instead of
decreasing
---
 sys-utils/lscpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index b169d7a..ecff1a7 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1281,7 +1281,7 @@ get_cell_data(struct lscpu_desc *desc, int idx, int col,
 			if (j != 0) {
 				*p++ = mod->compat ? ',' : ':';
 				*p = '\0';
-				sz++;
+				sz--;
 			}
 		}
 		break;
@@ -1353,7 +1353,7 @@ get_cell_header(struct lscpu_desc *desc, int col,
 			if (i > 0) {
 				*p++ = mod->compat ? ',' : ':';
 				*p = '\0';
-				sz++;
+				sz--;
 			}
 		}
 		if (desc->ncaches)
-- 
2.1.4



             reply	other threads:[~2016-02-27 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-27 15:00 Yuriy M. Kaminskiy [this message]
2016-02-27 16:14 ` [PATCH 2/3] lib/sysfs.c sys-utils/lsns.c: fix error return Yuriy M. Kaminskiy
2016-02-27 16:27   ` [PATCH 3/3] snprintf: safer (and uniform) handling of return value Yuriy M. Kaminskiy
2016-03-07 12:43     ` Karel Zak
2016-03-07 14:16 ` [PATCH] lscpu: fix backward buffer size adjustment after adding delimiter Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3r3fymc4d.fsf@gmail.com \
    --to=yumkam@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.