Applications+DevTools+MenuApplets: Drop "unix" pledge when possible

Now that the "unix" pledge is no longer required for socket I/O, we can
drop it after making the connections we need in a program.

In most GUI program cases, once we've connected to the WindowServer by
instantiating a GApplication, we no longer need "unix" :^)
This commit is contained in:
Andreas Kling 2020-01-12 11:59:11 +01:00
parent 114a770c6f
commit f813bb52a2
Notes: sideshowbarker 2024-07-19 10:08:36 +09:00
12 changed files with 29 additions and 8 deletions

View file

@ -50,6 +50,11 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio thread shared_buffer cpath rpath wpath fattr proc exec", nullptr) < 0) {
perror("pledge");
return 1;
}
auto window = GWindow::construct();
window->set_title("File Manager");

View file

@ -31,7 +31,7 @@ int main(int argc, char* argv[])
GApplication app(argc, argv);
if (pledge("stdio unix shared_buffer rpath", nullptr) < 0) {
if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
perror("pledge");
return 1;
}

View file

@ -18,7 +18,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio unix shared_buffer rpath", nullptr) < 0) {
if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
perror("pledge");
return 1;
}

View file

@ -27,6 +27,11 @@ int main(int argc, char** argv)
auto audio_client = AClientConnection::construct();
audio_client->handshake();
if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
auto window = GWindow::construct();
window->set_title("SoundPlayer");
window->set_resizable(false);

View file

@ -56,7 +56,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio proc shared_buffer rpath unix", nullptr) < 0) {
if (pledge("stdio proc shared_buffer rpath", nullptr) < 0) {
perror("pledge");
return 1;
}

View file

@ -12,7 +12,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio shared_buffer proc exec rpath unix", nullptr) < 0) {
if (pledge("stdio shared_buffer proc exec rpath", nullptr) < 0) {
perror("pledge");
return 1;
}

View file

@ -153,7 +153,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio tty rpath cpath wpath shared_buffer proc exec unix", nullptr) < 0) {
if (pledge("stdio tty rpath cpath wpath shared_buffer proc exec", nullptr) < 0) {
perror("pledge");
return 1;
}

View file

@ -11,7 +11,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio rpath cpath wpath shared_buffer unix", nullptr) < 0) {
if (pledge("stdio rpath cpath wpath shared_buffer", nullptr) < 0) {
perror("pledge");
return 1;
}

View file

@ -103,6 +103,11 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio tty rpath cpath wpath shared_buffer proc fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
Function<void()> update_actions;
g_window = GWindow::construct();

View file

@ -69,5 +69,11 @@ int main(int argc, char** argv)
auto widget = AudioWidget::construct();
window->set_main_widget(widget);
window->show();
if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
return app.exec();
}

View file

@ -79,7 +79,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio shared_buffer rpath unix", nullptr) < 0) {
if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
perror("pledge");
return 1;
}

View file

@ -71,7 +71,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
if (pledge("stdio shared_buffer rpath unix", nullptr) < 0) {
if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
perror("pledge");
return 1;
}