bin/55980: [patch] rmuser does not remove IPC mechanisms owned
by the user
Christian S.J. Peron
maneo at bsdpro.com
Fri Feb 27 14:10:16 PST 2004
The following reply was made to PR bin/55980; it has been noted by GNATS.
From: "Christian S.J. Peron" <maneo at bsdpro.com>
To: freebsd-gnats-submit at FreeBSD.org
Cc:
Subject: Re: bin/55980: [patch] rmuser does not remove IPC mechanisms owned by the user
Date: Fri, 27 Feb 2004 18:01:20 +0000
My previous patch implements redundant flags when calling xargs.
I have re-created the patch to be a bit more sane.
--- usr.sbin/adduser/rmuser.sh.bak Fri Feb 27 15:54:13 2004
+++ usr.sbin/adduser/rmuser.sh Fri Feb 27 17:41:32 2004
@@ -145,6 +145,19 @@
verbose && echo '.'
}
+# rm_ipc login
+# Remove all IPC mechanisms which are owned by the user.
+#
+rm_ipc() {
+ verbose && echo "Removing IPC mechanisms"
+ for i in s m q
+ do
+ ipcs -$i | grep ^$i | awk -v usr=$1 \
+ '{ if ($5 == usr) { print $2 } }' | \
+ xargs -n 1 ipcrm -$i
+ done
+}
+
# rm_user login
# Remove user $login from the system. This subroutine makes use
# of the pw(8) command to remove a user from the system. The pw(8)
@@ -338,6 +351,7 @@
! verbose && echo -n "Removing user ($_user):"
rm_crontab $_user
rm_at_jobs $_user
+ rm_ipc $_user
kill_procs $_user
rm_files $_user
rm_mail $_user
More information about the freebsd-bugs
mailing list