Package: update-inetd Version: 4.30 Followup-For: Bug #63504
I'm providing a patch to fix this issue. It uses the variable $success to check whether or not the file needs updates. If it does, it gets overwritten, if not the temp file is unlinked. This will cover enable/disable/add and remove. -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable') Architecture: i386 (x86_64) Kernel: Linux 2.6.24-1-amd64 (SMP w/1 CPU core) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages update-inetd depends on: ii debconf [debconf-2.0] 1.5.20 Debian configuration management sy update-inetd recommends no packages. -- debconf-show failed -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
*** /usr/share/perl5/DebianNet.pm 2008-04-22 23:41:15.000000000 +0100 --- Desktop/DebianNet.pm 2008-04-23 00:17:02.000000000 +0100 *************** *** 102,107 **** --- 102,108 ---- print (ICWRITE "$newentry\n") || die "Error writing new $inetdcf: $!\n"; $found = 0; $success = 1; + } print ICWRITE "$_\n"; } *************** *** 111,121 **** } close(ICWRITE) || die "Error closing new inetd.conf: $!\n"; ! rename("$inetdcf.new","$inetdcf") || ! die "Error installing new $inetdcf: $!\n"; ! chmod(0644, "$inetdcf"); ! ! &wakeup_inetd; } } --- 112,126 ---- } close(ICWRITE) || die "Error closing new inetd.conf: $!\n"; ! if ($success) { ! rename("$inetdcf.new","$inetdcf") || ! die "Error installing new $inetdcf: $!\n"; ! chmod(0644, "$inetdcf"); ! wakeup_inetd(1); ! } else { ! &printv("No services added\n"); ! unlink("$inetdcf.new") || die "Error removing temp $inetdcf: $!\n"; ! } } } *************** *** 124,129 **** --- 129,135 ---- sub remove_service { my($service) = @_; + my($success) = 0; unless(defined($service)) { return(-1) }; chomp($service); if($service eq "") { *************** *** 153,173 **** print ICWRITE "$_\n"; } else { &printv("Removing line: \`$_'\n"); } } close(ICREAD); close(ICWRITE); ! ! rename("$inetdcf.new", "$inetdcf") || die "Error installing new $inetdcf: $!\n"; ! chmod(0644, "$inetdcf"); ! ! wakeup_inetd(1); return(1); } sub disable_service { my($service, $pattern) = @_; unless (defined($service)) { return(-1) }; unless (defined($pattern)) { $pattern = ''; } chomp($service); --- 159,184 ---- print ICWRITE "$_\n"; } else { &printv("Removing line: \`$_'\n"); + $success = 1; } } close(ICREAD); close(ICWRITE); ! if ($success) { ! rename("$inetdcf.new","$inetdcf") || die "Error installing new $inetdcf: $!\n"; ! chmod(0644, "$inetdcf"); ! wakeup_inetd(1); ! } else { ! &printv("No services disabled\n"); ! unlink("$inetdcf.new") || die "Error removing temp $inetdcf: $!\n"; ! } return(1); } sub disable_service { my($service, $pattern) = @_; + my($success) = 0; unless (defined($service)) { return(-1) }; unless (defined($pattern)) { $pattern = ''; } chomp($service); *************** *** 193,214 **** if (/^$service\s+\w+\s+/ and /$pattern/) { &printv("Processing service \`$service' ... disabled\n"); $_ =~ s/^(.+)$/$sep$1/; } print ICWRITE "$_\n"; } close(ICREAD); close(ICWRITE) || die "Error closing new inetd.conf: $!\n"; ! ! rename("$inetdcf.new","$inetdcf") || die "Error installing new $inetdcf: $!\n"; ! chmod(0644, "$inetdcf"); ! ! wakeup_inetd(1); return(1); } sub enable_service { my($service, $pattern) = @_; unless (defined($service)) { return(-1) }; unless (defined($pattern)) { $pattern = ''; } chomp($service); --- 204,231 ---- if (/^$service\s+\w+\s+/ and /$pattern/) { &printv("Processing service \`$service' ... disabled\n"); $_ =~ s/^(.+)$/$sep$1/; + $success = 1; } print ICWRITE "$_\n"; } close(ICREAD); close(ICWRITE) || die "Error closing new inetd.conf: $!\n"; ! ! if ($success) { ! rename("$inetdcf.new","$inetdcf") || die "Error installing new $inetdcf: $!\n"; ! chmod(0644, "$inetdcf"); ! wakeup_inetd(1); ! } else { ! &printv("No services disabled\n"); ! unlink("$inetdcf.new") || die "Error removing temp $inetdcf: $!\n"; ! } return(1); } sub enable_service { my($service, $pattern) = @_; + my($success); unless (defined($service)) { return(-1) }; unless (defined($pattern)) { $pattern = ''; } chomp($service); *************** *** 219,235 **** if (/^$sep$service\s+\w+\s+/ and /$pattern/) { &printv("Processing service \`$service' ... enabled\n"); $_ =~ s/^$sep//; } print ICWRITE "$_\n"; } close(ICREAD); close(ICWRITE) || die "Error closing new inetd.conf: $!\n"; ! ! rename("$inetdcf.new","$inetdcf") || die "Error installing new $inetdcf: $!\n"; ! chmod(0644, "$inetdcf"); ! ! &wakeup_inetd; return(1); } --- 236,256 ---- if (/^$sep$service\s+\w+\s+/ and /$pattern/) { &printv("Processing service \`$service' ... enabled\n"); $_ =~ s/^$sep//; + $success = 1; } print ICWRITE "$_\n"; } close(ICREAD); close(ICWRITE) || die "Error closing new inetd.conf: $!\n"; ! if ($success) { ! rename("$inetdcf.new","$inetdcf") || die "Error installing new $inetdcf: $!\n"; ! chmod(0644, "$inetdcf"); ! wakeup_inetd(1); ! } else { ! &printv("No services enabled\n"); ! unlink("$inetdcf.new") || die "Error removing temp $inetdcf: $!\n"; ! } return(1); }