diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index ab49f2cadf..3528f4bae6 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -1623,49 +1623,6 @@ ErrorOr mkfifo(StringView pathname, mode_t mode) return mknod(pathname, mode | S_IFIFO, 0); } -ErrorOr setenv(StringView name, StringView value, bool overwrite) -{ - auto builder = TRY(StringBuilder::create()); - TRY(builder.try_append(name)); - TRY(builder.try_append('\0')); - TRY(builder.try_append(value)); - TRY(builder.try_append('\0')); - // Note the explicit null terminators above. - auto c_name = builder.string_view().characters_without_null_termination(); - auto c_value = c_name + name.length() + 1; - auto rc = ::setenv(c_name, c_value, overwrite); - if (rc < 0) - return Error::from_errno(errno); - return {}; -} - -ErrorOr unsetenv(StringView name) -{ - auto builder = TRY(StringBuilder::create()); - TRY(builder.try_append(name)); - TRY(builder.try_append('\0')); - - // Note the explicit null terminator above. - auto rc = ::unsetenv(builder.string_view().characters_without_null_termination()); - if (rc < 0) - return Error::from_errno(errno); - return {}; -} - -ErrorOr putenv(StringView env) -{ -#ifdef AK_OS_SERENITY - auto rc = serenity_putenv(env.characters_without_null_termination(), env.length()); -#else - // Leak somewhat unavoidable here due to the putenv API. - auto leaked_new_env = strndup(env.characters_without_null_termination(), env.length()); - auto rc = ::putenv(leaked_new_env); -#endif - if (rc < 0) - return Error::from_errno(errno); - return {}; -} - ErrorOr posix_openpt(int flags) { int const rc = ::posix_openpt(flags); diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 70e350eacd..799e9ee501 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -228,9 +228,6 @@ ErrorOr> getgroups(); ErrorOr setgroups(ReadonlySpan); ErrorOr mknod(StringView pathname, mode_t mode, dev_t dev); ErrorOr mkfifo(StringView pathname, mode_t mode); -ErrorOr setenv(StringView, StringView, bool); -ErrorOr unsetenv(StringView); -ErrorOr putenv(StringView); ErrorOr posix_openpt(int flags); ErrorOr grantpt(int fildes); ErrorOr unlockpt(int fildes);