浏览代码

Updates for Hurd

Wichert Akkerman 27 年之前
父节点
当前提交
6bdebc1cb0
共有 3 个文件被更改,包括 13 次插入3 次删除
  1. 7 0
      ChangeLog
  2. 2 2
      lib/lock.c
  3. 4 1
      main/help.c

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+Wed Oct  6 14:40:33 CEST 1999 Wichert Akkerman <wakkerma@debian.org>
+
+  * Lock complete lockfile for database: it's empty anyway, and Hurd
+    doesn't support partial locks currently
+  * Don't use PATH_MAX but allocate necessay memory in checkpath().
+    Useful for system that don't have PATH_MAX (like Hurd)
+
 Tue Oct  5 19:16:38 CEST 1999 Wichert Akkerman <wakkerma@debian.org>
 
   * Set docdir to $(datadir)/doc

+ 2 - 2
lib/lock.c

@@ -42,7 +42,7 @@ static void cu_unlockdb(int argc, void **argv) {
   fl.l_type= F_UNLCK;
   fl.l_whence= SEEK_SET;
   fl.l_start= 0;
-  fl.l_len= 1;
+  fl.l_len= 0;
   if (fcntl(dblockfd,F_SETLK,&fl) == -1)
     ohshite(_("unable to unlock dpkg status database"));
 }
@@ -72,7 +72,7 @@ void lockdatabase(const char *admindir) {
   fl.l_type= F_WRLCK;
   fl.l_whence= SEEK_SET;
   fl.l_start= 0;
-  fl.l_len= 1;
+  fl.l_len= 0;
   if (fcntl(dblockfd,F_SETLK,&fl) == -1) {
     if (errno == EWOULDBLOCK || errno == EAGAIN)
       ohshit(_("status database area is locked - another dpkg/dselect is running"));

+ 4 - 1
main/help.c

@@ -66,6 +66,7 @@ struct filenamenode *namenodetouse(struct filenamenode *namenode, struct pkginfo
 }
 
 void checkpath(void) {
+/* Verify that some programs can be found in the PATH. */
   static const char *const checklist[]= {
     "ldconfig", "start-stop-daemon", "install-info", "update-rc.d", 0
   };
@@ -73,12 +74,13 @@ void checkpath(void) {
   struct stat stab;
   const char *const *clp;
   const char *path, *s, *p;
-  char buf[PATH_MAX+2];
+  char* buf;
   int warned= 0;
   long l;
 
   path= getenv("PATH");
   if (!path) fputs(_("dpkg - warning: PATH is not set.\n"), stderr);
+  buf=(char*)m_malloc(strlen(path)+1);
   
   for (clp=checklist; *clp; clp++) {
     s= path;
@@ -98,6 +100,7 @@ void checkpath(void) {
     }
   }
 
+  free(buf);
   if (warned)
     forcibleerr(fc_badpath,_("%d expected program(s) not found on PATH.\nNB: root's "
                 "PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin."),