All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tycho Andersen <tycho@docker.com>
To: linux-audit@redhat.com
Cc: Tycho Andersen <tycho@docker.com>
Subject: [PATCH 2/3] auparse: remove use of rawmemchr
Date: Mon, 13 Mar 2017 17:14:33 -0700	[thread overview]
Message-ID: <20170314001434.8082-3-tycho@docker.com> (raw)
In-Reply-To: <20170314001434.8082-1-tycho@docker.com>

just iterate over the string instead, it's much simpler and doesn't use a
glibc extension.

Signed-off-by: Tycho Andersen <tycho@docker.com>
---
 auparse/interpret.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/auparse/interpret.c b/auparse/interpret.c
index 1f517d7..57da00c 100644
--- a/auparse/interpret.c
+++ b/auparse/interpret.c
@@ -803,10 +803,9 @@ static const char *print_proctitle(const char *val)
 		size_t len = strlen(val) / 2;
 		const char *end = out + len;
 		char *ptr = out;
-		while ((ptr  = rawmemchr(ptr, '\0'))) {
-			if (ptr >= end)
-				break;
-			*ptr = ' ';
+		while (ptr < end) {
+			if (*ptr == '\0')
+				*ptr = ' ';
 			ptr++;
 		}
 	}
-- 
2.9.3

  parent reply	other threads:[~2017-03-14  0:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14  0:14 port of audit to Alpine Linux/MUSL Tycho Andersen
2017-03-14  0:14 ` [PATCH 1/3] auditctl: include headers to make build work with musl Tycho Andersen
2017-03-14  0:14 ` Tycho Andersen [this message]
2017-03-14  0:14 ` [PATCH 3/3] all: get rid of strndupa Tycho Andersen

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=20170314001434.8082-3-tycho@docker.com \
    --to=tycho@docker.com \
    --cc=linux-audit@redhat.com \
    /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.