patch-buildindex_c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. $OpenBSD: patch-buildindex_c,v 1.1.1.1 2001/02/06 11:50:24 wilfried Exp $
  2. --- buildindex.c.orig Sun Feb 14 10:50:42 1999
  3. +++ buildindex.c Mon Feb 5 08:14:34 2001
  4. @@ -89,7 +89,7 @@ main(argc, argv)
  5. */
  6. if (fstat(fileno(fp), &st))
  7. {
  8. - sprintf(indname, "%s: fstat", argv[i]);
  9. + snprintf(indname, sizeof(indname), "%s: fstat", argv[i]);
  10. perror(indname);
  11. fclose(fp);
  12. continue;
  13. @@ -97,7 +97,7 @@ main(argc, argv)
  14. if (lock && lockit(fileno(fp), F_WRLCK))
  15. {
  16. - sprintf(indname, "%s: Warning: Couldn't lock", argv[i]);
  17. + snprintf(indname, sizeof(indname), "%s: Warning: Couldn't lock", argv[i]);
  18. perror(indname);
  19. locked = 0;
  20. }
  21. @@ -116,7 +116,7 @@ main(argc, argv)
  22. bt.prefix = NULL; /* no prefix comparisons */
  23. /* Index files have ".ind" extensions */
  24. - sprintf(indname, "%s.ind", argv[i]);
  25. + snprintf(indname, sizeof(indname), "%s.ind", argv[i]);
  26. if ((db = dbopen(indname, O_CREAT | O_RDWR | O_TRUNC,
  27. st.st_mode, DB_BTREE, &bt)) == NULL)
  28. {
  29. @@ -166,7 +166,7 @@ main(argc, argv)
  30. continue;
  31. }
  32. sscanf(c+1, "%d", &frame);
  33. - sprintf(framebuf, "%07d", frame);
  34. + snprintf(framebuf, sizeof(framebuf), "%07d", frame);
  35. pos = htonl(pos);
  36. if ((db->put)(db, &key, &data, 0))