Prechádzať zdrojové kódy

check for malloc failure and actually look in /home/wichert for file instead of looking in confdir twice

Wichert Akkerman 24 rokov pred
rodič
commit
a24e608410
4 zmenil súbory, kde vykonal 19 pridanie a 5 odobranie
  1. 6 0
      ChangeLog
  2. 7 1
      debian/changelog
  3. 5 3
      lib/myopt.c
  4. 1 1
      version-nr

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+Tue Jul  2 12:29:52 CEST 2002 Wichert Akkerman <wichert@deephackmode.org>
+
+  * Merge from HEAD:
+    + lib/myopt: check for malloc failure and actually look in $HOME for
+      file instead of looking in confdir twice
+
 Tue Jul  2 10:20:40 CEST 2002 Wichert Akkerman <wichert@deephackmode.org>
 
   * debian/rules: cp instead of mv since we need files for both dpkg

+ 7 - 1
debian/changelog

@@ -1,3 +1,9 @@
+dpkg (1.10.2) unstable; urgency=low
+
+  * Make configuration files in $HOME work again
+
+ -- Wichert Akkerman <wakkerma@debian.org>  UNRELEASED
+
 dpkg (1.10.1) unstable; urgency=low
 
   * Add conflict with dpkg-iasearch which intruded on our namespace.
@@ -11,7 +17,7 @@ dpkg (1.10.1) unstable; urgency=low
     Closes: Bug#150739
   * Move dpkg.cfg and dselect.cfg manpages into dpkg package. Closes: Bug#132901
 
- -- Wichert Akkerman <wakkerma@debian.org>  Tue,  2 Jul 2002 10:30:34 +0200
+ -- Wichert Akkerman <wakkerma@debian.org>  Tue,  2 Jul 2002 12:34:07 +0200
 
 dpkg (1.10) unstable; urgency=low
 

+ 5 - 3
lib/myopt.c

@@ -3,7 +3,7 @@
  * myopt.c - my very own option parsing
  *
  * Copyright (C) 1994,1995 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright (C) 2000 Wichert Akkerman <wakkerma@debian.org>
+ * Copyright (C) 2000,2002 Wichert Akkerman <wichert@deephackmode.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as
@@ -90,15 +90,17 @@ void loadcfgfile(const char *prog, const struct cmdinfo* cmdinfos) {
   int l1, l2;
   l1 = strlen(CONFIGDIR "/.cfg") + strlen(prog);
   file = malloc(l1 + 1);
+  if (file==NULL) ohshite(_("Error allocating memory for cfgfilename"));
   sprintf(file, CONFIGDIR "/%s.cfg", prog);
   myfileopt(file, cmdinfos);
   if ((home = getenv("HOME")) != NULL) {
-    l2 = strlen(home) + strlen("/.cfg") + strlen(prog);
+    l2 = strlen(home) + 1 + strlen("/.cfg") + strlen(prog);
     if (l2 > l1) {
       free(file);
       file = malloc(l2 + 1);
-      l1 = l2;
+      if (file==NULL) ohshite(_("Error allocating memory for cfgfilename"));
     }
+    sprintf(file, "%s/.%s.cfg", home, prog);
     myfileopt(file, cmdinfos);
   }
   free(file);

+ 1 - 1
version-nr

@@ -1 +1 @@
-1.10.1
+1.10.2