patch-gnats_query_c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. $OpenBSD: patch-gnats_query_c,v 1.1 2003/08/25 23:35:06 brad Exp $
  2. --- gnats/query.c.orig Wed Nov 25 07:15:19 1998
  3. +++ gnats/query.c Wed Jul 2 13:23:13 2003
  4. @@ -147,7 +147,7 @@ make_path (c, n)
  5. {
  6. char *path = (char *) xmalloc (PATH_MAX);
  7. - sprintf (path, "%s/%s/%s", gnats_root, c, n);
  8. + snprintf (path, PATH_MAX, "%s/%s/%s", gnats_root, c, n);
  9. return path;
  10. }
  11. @@ -203,7 +203,7 @@ regcmp (pat, match)
  12. switch (r.i)
  13. {
  14. case -2:
  15. - fprintf (stderr, "%s: warning: re_match died with pattern %s and string $s\n",
  16. + fprintf (stderr, "%s: warning: re_match died with pattern %s and string %s\n",
  17. program_name, pat, match);
  18. /*FALLTHRU*/
  19. case -1:
  20. @@ -251,7 +251,7 @@ regfind (pat, match)
  21. switch (r.i)
  22. {
  23. case -2:
  24. - fprintf (stderr, "%s: warning: re_match died with pattern %s and string $s\n",
  25. + fprintf (stderr, "%s: warning: re_match died with pattern %s and string %s\n",
  26. program_name, pat, match);
  27. /*FALLTHRU*/
  28. case -1:
  29. @@ -301,8 +301,6 @@ pr_matches (s, i, opened)
  30. Index *i;
  31. int *opened;
  32. {
  33. - int status;
  34. -
  35. *opened = 0;
  36. if (skip_closed && check_state_type (i->state, "closed"))
  37. @@ -343,7 +341,7 @@ pr_matches (s, i, opened)
  38. int val = 0;
  39. char *path = make_path (i->category, i->number);
  40. - if (val = get_pr (path, i->number, quiet))
  41. + if ((val = get_pr (path, i->number, quiet)))
  42. *opened = 1;
  43. xfree (path);
  44. @@ -490,15 +488,13 @@ print_pr (path, p, opened, i)
  45. {
  46. char *t, *q, *tempstr;
  47. - tempstr = (char *) xmalloc (strlen (i->synopsis) + 1);
  48. - strcpy (tempstr, i->synopsis);
  49. + tempstr = xstrdup(i->synopsis);
  50. fprintf (outfile, "%-8.8s|%-16.16s|%-128.128s|%-3.3s|",
  51. i->number, i->category, disbar (tempstr), i->confidential);
  52. xfree (tempstr);
  53. /* Trim `foo (Full Foo)' to just `foo'. */
  54. - tempstr = (char *) xmalloc (strlen (i->responsible) + 1);
  55. - strcpy (tempstr, i->responsible);
  56. + tempstr = xstrdup(i->responsible);
  57. q = (char *) strchr (tempstr, ' ');
  58. if (q != NULL)
  59. *q = '\0';
  60. @@ -550,15 +546,13 @@ print_pr (path, p, opened, i)
  61. {
  62. char *t, *q, *tempstr;
  63. - tempstr = (char *) xmalloc (strlen (i->synopsis) + 1);
  64. - strcpy (tempstr, i->synopsis);
  65. + tempstr = xstrdup(i->synopsis);
  66. fprintf (outfile, "%s|%s|%s|%s|",
  67. i->number, i->category, disbar (tempstr), i->confidential);
  68. xfree (tempstr);
  69. /* Trim `foo (Full Foo)' to just `foo'. */
  70. - tempstr = (char *) xmalloc (strlen (i->responsible) + 1);
  71. - strcpy (tempstr, i->responsible);
  72. + tempstr = xstrdup(i->responsible);
  73. q = (char *) strchr (tempstr, ' ');
  74. if (q != NULL)
  75. *q = '\0';
  76. @@ -611,8 +605,7 @@ print_pr (path, p, opened, i)
  77. char *q, *tempstr;
  78. /* Trim `foo (Full Foo)' to just `foo'. */
  79. - tempstr = (char *) xmalloc (strlen (i->responsible) + 1);
  80. - strcpy (tempstr, i->responsible);
  81. + tempstr = xstrdup(i->responsible);
  82. q = (char *) strchr (tempstr, ' ');
  83. if (q != NULL)
  84. *q = '\0';