Lines 62-71
Link Here
|
62 |
cleanup(0); |
62 |
cleanup(0); |
63 |
humanize_number(humbuf, sizeof humbuf, sz, "", HN_AUTOSCALE, |
63 |
humanize_number(humbuf, sizeof humbuf, sz, "", HN_AUTOSCALE, |
64 |
HN_NOSPACE); |
64 |
HN_NOSPACE); |
65 |
errx(2, |
65 |
/* XXX: Maintain 80 column width in the error message. */ |
66 |
"%s: can't find enough temporary space to extract the files, please set your\n" |
66 |
errx(EXIT_FAILURE, |
67 |
"PKG_TMPDIR environment variable to a location with at least %s bytes\n" |
67 |
"%s.%s: not enough temporary space to extract the files; set PKG_TMPDIR in\n" |
68 |
"free", __func__, humbuf); |
68 |
"your environment to a location with at least %s bytes free", |
|
|
69 |
progname, __func__, humbuf); |
69 |
return NULL; |
70 |
return NULL; |
70 |
} |
71 |
} |
71 |
return pen; |
72 |
return pen; |
Lines 79-85
Link Here
|
79 |
pushPen(const char *pen) |
80 |
pushPen(const char *pen) |
80 |
{ |
81 |
{ |
81 |
if (++pdepth == MAX_STACK) |
82 |
if (++pdepth == MAX_STACK) |
82 |
errx(2, "%s: stack overflow.\n", __func__); |
83 |
errx(2, "%s.%s: stack overflow.", progname, __func__); |
83 |
pstack[pdepth] = strdup(pen); |
84 |
pstack[pdepth] = strdup(pen); |
84 |
|
85 |
|
85 |
return pstack[pdepth]; |
86 |
return pstack[pdepth]; |
Lines 131-139
Link Here
|
131 |
if (min_free(pen) < sz) { |
132 |
if (min_free(pen) < sz) { |
132 |
rmdir(pen); |
133 |
rmdir(pen); |
133 |
cleanup(0); |
134 |
cleanup(0); |
134 |
errx(2, "%s: not enough free space to create '%s'.\n" |
135 |
errx(2, "%s.%s: not enough free space to create '%s'.\n" |
135 |
"Please set your PKG_TMPDIR environment variable to a location\n" |
136 |
"Please set your PKG_TMPDIR environment variable to a location\n" |
136 |
"with more space and\ntry the command again", __func__, pen); |
137 |
"with more space and\ntry the command again", progname, __func__, |
|
|
138 |
pen); |
137 |
} |
139 |
} |
138 |
|
140 |
|
139 |
if (!getcwd(cwd, FILENAME_MAX)) { |
141 |
if (!getcwd(cwd, FILENAME_MAX)) { |
Lines 143-149
Link Here
|
143 |
|
145 |
|
144 |
if (chdir(pen) == FAIL) { |
146 |
if (chdir(pen) == FAIL) { |
145 |
cleanup(0); |
147 |
cleanup(0); |
146 |
errx(2, "%s: can't chdir to '%s'", __func__, pen); |
148 |
errx(2, "%s:%s: can't chdir to '%s'", progname, __func__, pen); |
147 |
} |
149 |
} |
148 |
|
150 |
|
149 |
strcpy(PenLocation, pen); |
151 |
strcpy(PenLocation, pen); |
Lines 167-177
Link Here
|
167 |
|
169 |
|
168 |
if (chdir(PenLocation) == FAIL) { |
170 |
if (chdir(PenLocation) == FAIL) { |
169 |
cleanup(0); |
171 |
cleanup(0); |
170 |
errx(2, "%s: can't chdir back to '%s'", __func__, PenLocation); |
172 |
errx(2, "%s.%s: can't chdir back to '%s'", progname, __func__, PenLocation); |
171 |
} |
173 |
} |
172 |
|
174 |
|
173 |
if (left[0] == '/' && vsystem("/bin/rm -rf %s", left)) |
175 |
if (left[0] == '/' && vsystem("/bin/rm -rf %s", left)) |
174 |
warnx("couldn't remove temporary dir '%s'", left); |
176 |
warnx("%s.%s: couldn't remove temporary dir '%s'", progname, __func__, left); |
175 |
signal(SIGINT, oldsig); |
177 |
signal(SIGINT, oldsig); |
176 |
|
178 |
|
177 |
return 1; |
179 |
return 1; |
Lines 183-189
Link Here
|
183 |
struct statfs buf; |
185 |
struct statfs buf; |
184 |
|
186 |
|
185 |
if (statfs(tmpdir, &buf) != 0) { |
187 |
if (statfs(tmpdir, &buf) != 0) { |
186 |
warn("statfs"); |
188 |
warn("%s.%s: statfs", progname, __func__); |
187 |
return -1; |
189 |
return -1; |
188 |
} |
190 |
} |
189 |
return (off_t)buf.f_bavail * (off_t)buf.f_bsize; |
191 |
return (off_t)buf.f_bavail * (off_t)buf.f_bsize; |