FreeBSD Bugzilla – Attachment 11780 Details for
Bug 23052
[PATCH] rmuser fails to remove at jobs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.61 KB, created by
Peter Pentchev
on 2000-11-23 22:00:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Peter Pentchev
Created:
2000-11-23 22:00:01 UTC
Size:
2.61 KB
patch
obsolete
>Index: rmuser.perl >=================================================================== >RCS file: /home/ncvs/src/usr.sbin/adduser/rmuser.perl,v >retrieving revision 1.11 >diff -u -r1.11 rmuser.perl >--- rmuser.perl 2000/11/21 05:52:35 1.11 >+++ rmuser.perl 2000/11/23 21:27:47 >@@ -199,7 +199,7 @@ > # Remove the user's at jobs, if any > # (probably also needs to be done before password databases are updated) > >-&remove_at_jobs($login_name, $uid); >+&remove_at_jobs($login_name); > > # > # Kill all the user's processes >@@ -464,32 +464,75 @@ > printf STDERR " done.\n"; > } > >-sub remove_at_jobs { >- local($login_name, $uid) = @_; >- local($i, $owner, $found); >- >- $found = 0; >- opendir(ATDIR, $atjob_dir) || return; >- while ($i = readdir(ATDIR)) { >- next if $i eq '.'; >- next if $i eq '..'; >- next if $i eq '.lockfile'; > >- $owner = (stat("$atjob_dir/$i"))[4]; # UID >- if ($uid == $owner) { >- if (!$found) { >- print STDERR "Removing user's at jobs:"; >- $found = 1; >- } >- # Use atrm to remove the job >- print STDERR " $i"; >- system('/usr/bin/atrm', $i); >+sub invoke_atq { >+ local *ATQ; >+ my($user) = (shift || ""); >+ my($path_atq) = "/usr/bin/atq"; >+ my(@at) = (); >+ my($pid, $line); >+ >+ return @at if ($user eq ""); >+ >+ if (!defined($pid = open(ATQ, "-|"))) { >+ die("creating pipe to atq: $!\n"); >+ } elsif ($pid == 0) { >+ exec($path_atq, $user); >+ die("executing $path_atq: $!\n"); >+ } >+ >+ while(defined($_ = <ATQ>)) { >+ chomp; >+ if (/^\d\d:\d\d:\d\d\s+\d\d\/\d\d\/\d\d\s+(\S+)\s+\S+\s+(\d+)$/) { >+ push(@at, $2) if ($1 eq $user); > } > } >- closedir(ATDIR); >- if ($found) { >- print STDERR " done.\n"; >+ close ATQ; >+ return @at; >+} >+ >+sub invoke_atrm { >+ local *ATRM; >+ my($user) = (shift || ""); >+ my($path_atrm) = "/usr/bin/atrm"; >+ my(@jobs) = @_; >+ my($pid); >+ my($txt) = ""; >+ >+ return "Invalid arguments" if (($user eq "") || ($#jobs == -1)); >+ >+ if (!defined($pid = open(ATRM, "-|"))) { >+ die("creating pipe to atrm: $!\n"); >+ } elsif ($pid == 0) { >+ exec($path_atrm, $user, @jobs); >+ } >+ >+ while(defined($_ = <ATRM>)) { >+ $txt .= $_; > } >+ close ATRM; >+ return $txt; >+} >+ >+sub remove_at_jobs { >+ my($user) = (shift || ""); >+ my(@at, $atrm); >+ >+ return 1 if ($user eq ""); >+ >+ print STDERR "Removing user's at jobs:"; >+ @at = invoke_atq($user); >+ return 0 if ($#at == -1); >+ >+ print STDERR " @at:"; >+ $atrm = invoke_atrm($user, @at); >+ if ($atrm ne "") { >+ print STDERR " -- $atrm\n"; >+ return 1; >+ } >+ >+ print STDERR "done.\n"; >+ return 0; > } > > sub resolvelink {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 23052
: 11780 |
11781