From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 08/13] ipcs: clean up permissions printing
Date: Sun, 14 Oct 2012 21:22:20 +0100 [thread overview]
Message-ID: <1350246145-10600-9-git-send-email-kerolasa@iki.fi> (raw)
In-Reply-To: <1350246145-10600-1-git-send-email-kerolasa@iki.fi>
Remove old function, and make the new have same name as the old had.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/ipcs.c | 33 ++++-----------------------------
1 file changed, 4 insertions(+), 29 deletions(-)
diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 373e85e..960039e 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -691,32 +691,7 @@ int main (int argc, char **argv)
return EXIT_SUCCESS;
}
-static void print_perms (int id, struct ipc_perm *ipcp)
-{
- struct passwd *pw;
- struct group *gr;
-
- printf ("%-10d %-10o", id, ipcp->mode & 0777);
-
- if ((pw = getpwuid(ipcp->cuid)))
- printf(" %-10s", pw->pw_name);
- else
- printf(" %-10u", ipcp->cuid);
- if ((gr = getgrgid(ipcp->cgid)))
- printf(" %-10s", gr->gr_name);
- else
- printf(" %-10u", ipcp->cgid);
-
- if ((pw = getpwuid(ipcp->uid)))
- printf(" %-10s", pw->pw_name);
- else
- printf(" %-10u", ipcp->uid);
- if ((gr = getgrgid(ipcp->gid)))
- printf(" %-10s\n", gr->gr_name);
- else
- printf(" %-10u\n", ipcp->gid);
-}
-static void FIXED_print_perms(struct ipc_stat *is)
+static void print_perms(struct ipc_stat *is)
{
struct passwd *pw;
struct group *gr;
@@ -836,7 +811,7 @@ static void do_shm (char format, int use_proc)
for (shmdsp = shmds; shmdsp->next != NULL; shmdsp = shmdsp->next) {
if (format == CREATOR) {
- FIXED_print_perms (&(shmdsp->shm_perm));
+ print_perms (&(shmdsp->shm_perm));
continue;
}
pw = getpwuid(shmdsp->shm_perm.uid);
@@ -953,7 +928,7 @@ static void do_sem (char format, int use_proc)
for (semdsp = semds; semdsp->next != NULL; semdsp = semdsp->next) {
if (format == CREATOR) {
- FIXED_print_perms (&(semdsp->sem_perm));
+ print_perms (&(semdsp->sem_perm));
continue;
}
pw = getpwuid(semdsp->sem_perm.uid);
@@ -1059,7 +1034,7 @@ static void do_msg (char format, int use_proc)
for (msgdsp = msgds; msgdsp->next != NULL; msgdsp = msgdsp->next) {
if (format == CREATOR) {
- FIXED_print_perms (&(msgdsp->msg_perm));
+ print_perms (&(msgdsp->msg_perm));
continue;
}
pw = getpwuid(msgdsp->msg_perm.uid);
--
1.7.12.3
next prev parent reply other threads:[~2012-10-14 20:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-14 20:22 [PATCH 00/13] make ipcs to use proc Sami Kerola
2012-10-14 20:22 ` [PATCH 01/13] ipcs: add data structures to read state from /proc & /sys Sami Kerola
2012-10-14 20:22 ` [PATCH 02/13] ipcs: add /proc and /sys path definitions Sami Kerola
2012-11-05 16:43 ` Karel Zak
2012-10-14 20:22 ` [PATCH 03/13] ipcs: determine ipc limits from /proc Sami Kerola
2012-10-15 2:00 ` Mike Frysinger
2012-11-05 16:49 ` Karel Zak
2012-10-14 20:22 ` [PATCH 04/13] ipcs: add new permissions printing function Sami Kerola
2012-10-14 20:22 ` [PATCH 05/13] ipcs: read shared memory values from /proc Sami Kerola
2012-10-15 2:07 ` Mike Frysinger
2012-10-14 20:22 ` [PATCH 06/13] ipcs: read message queue " Sami Kerola
2012-10-14 20:22 ` [PATCH 07/13] ipsc: read semaphore " Sami Kerola
2012-10-14 20:22 ` Sami Kerola [this message]
2012-10-14 20:22 ` [PATCH 09/13] ipcs: make individual shared memory id printing to use /proc Sami Kerola
2012-11-05 16:53 ` Karel Zak
2012-10-14 20:22 ` [PATCH 10/13] ipcs: make individual message queue " Sami Kerola
2012-10-14 20:22 ` [PATCH 11/13] ipcs: make individual semaphore " Sami Kerola
2012-10-14 20:22 ` [PATCH 12/13] ipcs: validate numeric user input Sami Kerola
2012-10-14 20:22 ` [PATCH 13/13] docs: update TODO Sami Kerola
[not found] ` <20121015153924.GL18377@x2.net.home>
2012-10-22 20:23 ` [PATCH 00/13] make ipcs to use proc Sami Kerola
2012-11-05 16:42 ` Karel Zak
2012-11-07 9:40 ` Sami Kerola
2012-11-07 10:01 ` Karel Zak
2012-11-11 23:01 ` Sami Kerola
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=1350246145-10600-9-git-send-email-kerolasa@iki.fi \
--to=kerolasa@iki.fi \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).