Commit Diff


commit - ffe25f1f65e93981b34007bfe33975fca37f6512
commit + 8babeffbbc0cc0097c8d7b06582e370fa43ea05e
blob - 80b7c7bc08e2d02a159da7caccd5a3655eaba3f7
blob + cd7c8a2a496ff147638a89ec4f35597e82c355a1
--- gpass.c
+++ gpass.c
@@ -106,7 +106,9 @@ main(int argc, char *argv[])
 	}
 	for (char c = getc(dictfp); c != EOF; c = getc(dictfp))
 		nlines += (c == '\n');
-	plen = plen / log2(nlines) + 1;
+	int log2nlines = log2(nlines);
+	plen = plen / log2nlines + !!(plen % log2nlines);
+	plen += !plen;
 
 	for (int i = 0; i < npass; i++)
 		gen();