summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install/info/show.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_install/info/show.c')
-rw-r--r--usr.sbin/pkg_install/info/show.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c
index 5419bed5aae..2e24c8d8364 100644
--- a/usr.sbin/pkg_install/info/show.c
+++ b/usr.sbin/pkg_install/info/show.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: show.c,v 1.6 1998/11/22 23:22:41 espie Exp $ */
+/* $OpenBSD: show.c,v 1.7 1999/03/08 02:01:02 marc Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: show.c,v 1.6 1998/11/22 23:22:41 espie Exp $";
+static const char *rcsid = "$OpenBSD: show.c,v 1.7 1999/03/08 02:01:02 marc Exp $";
#endif
/*
@@ -97,10 +97,12 @@ show_index(char *title, char *fname)
}
else {
if (fgets(line, MAXINDEXSIZE+1, fp)) {
- if (line[MAXINDEXSIZE-1] != '\n') {
- line[MAXINDEXSIZE] = '\n';
+ int line_length = strlen(line);
+
+ if (line[line_length-1] != '\n') {
+ line[line_length] = '\n';
+ line[line_length+1] = 0;
}
- line[MAXINDEXSIZE+1] = 0;
}
(void) fclose(fp);
}