Преглед изворни кода

Update update-rc.d to check if codenumber is below 100

Wichert Akkerman пре 27 година
родитељ
комит
18b94069f0
3 измењених фајлова са 10 додато и 4 уклоњено
  1. 5 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 4 4
      scripts/update-rc.d.pl

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Thu Oct  7 01:16:23 CEST 1999 Wichert Akkerman <wakkerma@debian.org>
+
+  * Check if codenumber is between 0 and 99 instead of just checking
+    for a number
+
 Wed Oct  6 14:40:33 CEST 1999 Wichert Akkerman <wakkerma@debian.org>
 
   * Lock complete lockfile for database: it's empty anyway, and Hurd

+ 1 - 0
debian/changelog

@@ -5,6 +5,7 @@ dpkg (1.4.1.14) unstable; urgency=low
   * Install locale-files in /usr/share, Closes: Bug# 46631
   * Make /usr/share/doc/dpkg-dev a symlink to /usr/share/doc/dpkg
   * Actually include fix to make update-alternatives works filesystems (oops!)
+  * Check if codenumber is between 0 and 99, Closes: Bug# 46810
 
  -- Wichert Akkerman <wakkerma@debian.org>  Tue,  5 Oct 1999 19:19:05 +0200
 

+ 4 - 4
scripts/update-rc.d.pl

@@ -96,7 +96,7 @@ sub checklinks {
 	}
 	opendir(DIR, ".");
 	foreach $_ (readdir(DIR)) {
-	    next unless (/^[S|K][0-9]*$bn$/);
+	    next unless (/^[S|K]\d\d$bn$/);
 	    $fn = "$etcd$i.d/$_";
 	    $found = 1;
 	    $islnk = &is_link ($_[0], $fn, $bn);
@@ -123,8 +123,8 @@ sub defaults {
     &usage ("defaults takes only one or two codenumbers") if ($#ARGV > 2);
     $start = $stop = $ARGV[1] if ($#ARGV >= 1);
     $stop  =         $ARGV[2] if ($#ARGV >= 2);
-    &usage ("codenumber must be a number")
-	if ($start !~ /^[0-9]+$/ || $stop  !~ /^[0-9]+$/);
+    &usage ("codenumber must be a number between 0 and 99")
+	if ($start !~ /^\d\d$/ || $stop  !~ /^\d\d$/);
 
     $start = sprintf("%02d", $start);
     $stop  = sprintf("%02d", $stop);
@@ -149,7 +149,7 @@ sub startstop {
 	    &usage("expected start|stop");
 	}
 
-	if ($ARGV[1] !~ /^[0-9]+$/) {
+	if ($ARGV[1] !~ /^\d\d$/) {
 	    &usage("expected NN after $ARGV[0]");
 	}
 	$NN = sprintf("%02d", $ARGV[1]);