mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
If some files lost in /var/db/pkg/<port>/ after system crash f.e.,
pkg_manage silently dumps core, pkg_info claims about them to stderr, which makes very difficult to find what directory cause it via tons of pkg_info -a output. I found solution which covers both variants, now pkg_info claims about missing files to stdout among valid output with ERROR: prefix. It heals pkg_manage to not dump core and makes easy to find errors in pkg_info -a output by simple /ERROR 'more' command.
This commit is contained in:
parent
3c9c802973
commit
573999ad8a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9781
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static const char *rcsid = "$Id: show.c,v 1.5 1995/01/05 01:10:13 swallace Exp $";
|
||||
static const char *rcsid = "$Id: show.c,v 1.6 1995/05/30 03:50:02 rgrimes Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -35,13 +35,13 @@ show_file(char *title, char *fname)
|
||||
if (!Quiet)
|
||||
printf("%s%s", InfoPrefix, title);
|
||||
fp = fopen(fname, "r");
|
||||
if (!fp) {
|
||||
whinge("show_file: Can't open '%s' for reading.", fname);
|
||||
return;
|
||||
if (!fp)
|
||||
printf("ERROR: show_file: Can't open '%s' for reading!\n", fname);
|
||||
else {
|
||||
while (n = fread(line, 1, 1024, fp))
|
||||
fwrite(line, 1, n, stdout);
|
||||
fclose(fp);
|
||||
}
|
||||
while (n = fread(line, 1, 1024, fp))
|
||||
fwrite(line, 1, n, stdout);
|
||||
fclose(fp);
|
||||
printf("\n"); /* just in case */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user