summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authornat <nat@pkgsrc.org>2020-06-18 13:38:49 +0000
committernat <nat@pkgsrc.org>2020-06-18 13:38:49 +0000
commitb50b0d3c51ff567306f6532537ad2c96d50471fa (patch)
treef3f4427e216404304c1c920a17651a7791c8c709 /devel
parentaf3310ad73b7e8676cdc7910aa4a712f17151adc (diff)
downloadpkgsrc-b50b0d3c51ff567306f6532537ad2c96d50471fa.tar.gz
Use secondary buffer as an intermediatory to fix compilation with SSP_FORTIFY.
Diffstat (limited to 'devel')
-rw-r--r--devel/diffbreaker/files/diffbreaker/diffbreaker.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/devel/diffbreaker/files/diffbreaker/diffbreaker.c b/devel/diffbreaker/files/diffbreaker/diffbreaker.c
index 36b3d4dfa02..d179e9dad2a 100644
--- a/devel/diffbreaker/files/diffbreaker/diffbreaker.c
+++ b/devel/diffbreaker/files/diffbreaker/diffbreaker.c
@@ -1,4 +1,4 @@
-/* $NetBSD: diffbreaker.c,v 1.6 2020/06/18 00:00:25 nat Exp $ */
+/* $NetBSD: diffbreaker.c,v 1.7 2020/06/18 13:38:49 nat Exp $ */
/*-
* Copyright (c) 2018, 2019 Nathanial Sloss <nathanialsloss@yahoo.com.au>
@@ -101,9 +101,8 @@ mark_dirty(void)
continue;
}
if (*ORIGBUF(i) == '+') {
- if (j != i)
- strncpy(ORIGBUF(j), ORIGBUF(i), len);
- *ORIGBUF(j) = ' ';
+ strncpy(NEWBUF(j), ORIGBUF(i), len);
+ *NEWBUF(j) = ' ';
action[j] = 0;
}
break;
@@ -114,8 +113,7 @@ mark_dirty(void)
pending = false;
writesect = false;
action[j] = action[i];
- if (j != i)
- strncpy(ORIGBUF(j), ORIGBUF(i), len);
+ strncpy(NEWBUF(j), ORIGBUF(i), len);
break;
case 6: /* --- */
if (pending == false && writesect == false)
@@ -126,13 +124,11 @@ mark_dirty(void)
pending = true;
writetome = false;
writesect = true;
- if (j != i)
- strncpy(ORIGBUF(j), ORIGBUF(i), len);
+ strncpy(NEWBUF(j), ORIGBUF(i), len);
action[j] = action[i];
break;
case 7: /* +++ */
- if (j != i)
- strncpy(ORIGBUF(j), ORIGBUF(i), len);
+ strncpy(NEWBUF(j), ORIGBUF(i), len);
action[j] = action[i];
break;
case 1: /* unselected change */
@@ -141,11 +137,11 @@ mark_dirty(void)
writetome = true;
/* fallthrough */
default:
- if (j != i)
- strncpy(ORIGBUF(j), ORIGBUF(i), len);
+ strncpy(NEWBUF(j), ORIGBUF(i), len);
action[j] = action[i];
break;
}
+ strncpy(ORIGBUF(j), NEWBUF(j), len);
j++;
}
totalLines = display ? j-- : 0;