1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
--- misc-utils/look.c
+++ misc-utils/look.c
@@ -137,7 +137,15 @@
*++p = '\0';
if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb))
- err("%s: %s", file, strerror(errno));
+ {
+ /* if opening the primary file failed, fall back to cracklib word files */
+ file = "/usr/share/dict/cracklib-words";
+ if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb)) {
+ file = "/usr/share/dict/cracklib-small";
+ if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb))
+ err("%s: %s\n\tplease emerge sys-apps/cracklib-words or sys-apps/miscfiles", file, strerror(errno));
+ }
+ }
front = mmap(NULL, (size_t) sb.st_size, PROT_READ,
#ifdef MAP_FILE
MAP_FILE |
|