mirror of
https://github.com/openbsd/ports.git
synced 2026-06-17 23:13:55 +02:00
Fix ttypplot by moving pledge() call after open(/dev/tty).
Add 'use pledge()' marker to Makefile while there. ok tb@, fcambus@, naddy@
This commit is contained in:
@@ -3,12 +3,14 @@ COMMENT = realtime plotting utility for terminals
|
||||
GH_ACCOUNT = tenox7
|
||||
GH_PROJECT = ttyplot
|
||||
GH_TAGNAME = 1.7.4
|
||||
REVISION = 0
|
||||
|
||||
CATEGORIES = sysutils
|
||||
|
||||
# Apache 2.0
|
||||
PERMIT_PACKAGE = Yes
|
||||
|
||||
# uses pledge()
|
||||
WANTLIB += c curses m
|
||||
|
||||
MAKE_FLAGS = CC="${CC}" CFLAGS="${CFLAGS}"
|
||||
|
||||
@@ -12,3 +12,26 @@ Index: ttyplot.c
|
||||
#define _XOPEN_SOURCE_EXTENDED
|
||||
#else
|
||||
// This is needed for musl libc
|
||||
@@ -923,10 +923,6 @@ int main(int argc, char *argv[]) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
-#ifdef __OpenBSD__
|
||||
- if (pledge("stdio tty", NULL) == -1)
|
||||
- err(1, "pledge");
|
||||
-#endif
|
||||
|
||||
// Check if any colors are defined
|
||||
bool has_colors = false;
|
||||
@@ -986,6 +982,11 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
signal(SIGWINCH, signal_handler);
|
||||
signal(SIGINT, signal_handler);
|
||||
+
|
||||
+#ifdef __OpenBSD__
|
||||
+ if (pledge("stdio tty", NULL) == -1)
|
||||
+ err(1, "pledge");
|
||||
+#endif
|
||||
|
||||
while (1) {
|
||||
struct timeval timeout = calculate_clock_refresh_timeout_from(now.tv_usec);
|
||||
|
||||
Reference in New Issue
Block a user