]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-etc_dir.patch
- ugly gcc hack not needed.
[packages/rpm.git] / rpm-etc_dir.patch
CommitLineData
411771bd 1diff -Nru rpm-4.1/lib/rpmrc.c rpm-4.1.new/lib/rpmrc.c
2--- rpm-4.1/lib/rpmrc.c Tue Aug 20 16:53:44 2002
3+++ rpm-4.1.new/lib/rpmrc.c Tue Mar 11 18:41:48 2003
0cef5eac 4@@ -1756,27 +1756,39 @@
411771bd 5 /* Expand ~/ to $HOME/ */
6 fn[0] = '\0';
7 if (r[0] == '~' && r[1] == '/') {
80c5dfe1 8+ const char * etc_dir = getenv("HOME_ETC");
411771bd 9 const char * home = getenv("HOME");
10- if (home == NULL) {
11+ if (etc_dir) {
12+ if (strlen(etc_dir) > (sizeof(fn) - strlen(r))) {
80c5dfe1 13+ rpmError(RPMERR_RPMRC, _("Cannot read %s, HOME_ETC is too large.\n"),r);
411771bd 14+ rc = 1;
15+ break;
16+ }
17+ strcpy(fn, etc_dir);
18+ strncat(fn, "/", sizeof(fn) - strlen(fn));
19+ r+=2;
20+
411771bd 21+ } else {
22+ if (home == NULL) {
23 /* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
24- if (rcfiles == defrcfiles && myrcfiles != r)
25- continue;
26- rpmError(RPMERR_RPMRC, _("Cannot expand %s\n"), r);
27- rc = 1;
28- break;
29- }
30- if (strlen(home) > (sizeof(fn) - strlen(r))) {
31- rpmError(RPMERR_RPMRC, _("Cannot read %s, HOME is too large.\n"),
32+ if (rcfiles == defrcfiles && myrcfiles != r)
33+ continue;
34+ rpmError(RPMERR_RPMRC, _("Cannot expand %s\n"), r);
35+ rc = 1;
36+ break;
37+ }
38+ if (strlen(home) > (sizeof(fn) - strlen(r))) {
39+ rpmError(RPMERR_RPMRC, _("Cannot read %s, HOME is too large.\n"),
40 r);
41- rc = 1;
42- break;
43- }
44- strcpy(fn, home);
45- r++;
46- }
47- strncat(fn, r, sizeof(fn) - (strlen(fn) + 1));
48- fn[sizeof(fn)-1] = '\0';
49-
50+ rc = 1;
51+ break;
52+ }
53+ strcpy(fn, home);
54+ r++;
55+ }
56+ }
57+ strncat(fn, r, sizeof(fn) - (strlen(fn) + 1));
58+ fn[sizeof(fn)-1] = '\0';
59 /* Read another rcfile */
60 fd = Fopen(fn, "r.fpio");
61 if (fd == NULL || Ferror(fd)) {
62diff -Nru rpm-4.1/rpmio/macro.c rpm-4.1.new/rpmio/macro.c
63--- rpm-4.1/rpmio/macro.c Tue Sep 17 14:58:23 2002
64+++ rpm-4.1.new/rpmio/macro.c Tue Mar 11 18:21:59 2003
0cef5eac 65@@ -1614,15 +1614,22 @@
411771bd 66 buf[0] = '\0';
67 if (mfile[0] == '~' && mfile[1] == '/') {
68 char *home;
69- if ((home = getenv("HOME")) != NULL) {
70- mfile += 2;
71- strncpy(buf, home, sizeof(buf));
72- strncat(buf, "/", sizeof(buf) - strlen(buf));
80c5dfe1 73+ char *etc_dir = getenv("HOME_ETC");
411771bd 74+
75+ if (etc_dir) {
76+ mfile += 2;
411771bd 77+ strncpy(buf, etc_dir, sizeof(buf));
78+ strncat(buf, "/", sizeof(buf) - strlen(buf));
79+ } else {
80+ if ((home = getenv("HOME")) != NULL) {
81+ mfile += 2;
82+ strncpy(buf, home, sizeof(buf));
83+ strncat(buf, "/", sizeof(buf) - strlen(buf));
84 }
85+ }
86 }
87 strncat(buf, mfile, sizeof(buf) - strlen(buf));
88 buf[sizeof(buf)-1] = '\0';
89-
90 fd = Fopen(buf, "r.fpio");
91 if (fd == NULL || Ferror(fd)) {
92 if (fd) (void) Fclose(fd);
80c5dfe1
JB
93--- rpm-4.3/po/pl.po.orig 2003-06-10 23:59:11.000000000 +0200
94+++ rpm-4.3/po/pl.po 2003-06-11 00:06:16.000000000 +0200
95@@ -2834,6 +2834,10 @@
96 msgid "Please contact rpm-list@redhat.com\n"
97