diff --git a/tix/Makefile b/tix/Makefile
index 438e5a7f..efb8204d 100644
--- a/tix/Makefile
+++ b/tix/Makefile
@@ -4,10 +4,14 @@ include ../build-aux/version.mak
include ../build-aux/dirs.mak
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
-CXXFLAGS?=$(OPTLEVEL)
+CFLAGS?=$(OPTLEVEL)
+CFLAGS:=$(CFLAGS) -Wall -Wextra
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
-CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
+
+ifeq ($(HOST_IS_SORTIX),0)
+ CPPFLAGS+=-D_GNU_SOURCE
+endif
BINARIES:=\
porttix-create \
@@ -28,8 +32,8 @@ all: $(PROGRAMS)
.PHONY: all install clean
-%: %.cpp util.h
- $(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@
+%: %.c util.h
+ $(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) $< -o $@
$(DESTDIR)$(SBINDIR):
mkdir -p $@
diff --git a/tix/porttix-create.cpp b/tix/porttix-create.c
similarity index 97%
rename from tix/porttix-create.cpp
rename to tix/porttix-create.c
index 3f9381d6..3e79519f 100644
--- a/tix/porttix-create.cpp
+++ b/tix/porttix-create.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- porttix-create.cpp
+ porttix-create.c
Creates a port tix by generating patches using source code and tarballs.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -37,6 +34,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -45,7 +43,7 @@
#include "util.h"
-int redirect(const char* path, int flags, mode_t mode = 0)
+int redirect(const char* path, int flags, mode_t mode)
{
int fd = open(path, flags, mode);
if ( fd < 0 )
@@ -87,7 +85,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
@@ -362,7 +361,7 @@ int main(int argc, char* argv[])
// Create the patch between the source tix and the normalized tree.
char* patch_path = join_paths(porttix_path, "patch.patch");
- if ( fork_and_wait_or_death(false) )
+ if ( fork_and_wait_or_death_def(false) )
{
close(1);
if ( open(patch_path, O_WRONLY | O_CREAT | O_TRUNC, 0644) != 1 )
@@ -387,7 +386,7 @@ int main(int argc, char* argv[])
// Created the execpatch between the source tix and the normalized tree.
char* patch_exec_path = join_paths(porttix_path, "patch.execpatch");
- if ( fork_and_wait_or_death(false) )
+ if ( fork_and_wait_or_death_def(false) )
{
if ( redirect(patch_exec_path, O_WRONLY | O_CREAT | O_TRUNC, 0644) != 0 )
error(1, errno, "`%s'", patch_exec_path);
diff --git a/tix/srctix-create.cpp b/tix/srctix-create.c
similarity index 98%
rename from tix/srctix-create.cpp
rename to tix/srctix-create.c
index a4927fa8..f8032160 100644
--- a/tix/srctix-create.cpp
+++ b/tix/srctix-create.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- srctix-create.cpp
+ srctix-create.c
Converts an archived port tix into an archived source tix.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -37,6 +34,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -81,7 +79,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
diff --git a/tix/tix-build.cpp b/tix/tix-build.c
similarity index 93%
rename from tix/tix-build.cpp
rename to tix/tix-build.c
index 9ed5a457..c19b71a7 100644
--- a/tix/tix-build.cpp
+++ b/tix/tix-build.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- tix-build.cpp
+ tix-build.c
Compile a source tix into a tix suitable for installation.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -38,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -342,9 +340,9 @@ void SetNeedVariableBuildTool(metainfo_t* minfo,
const char* value)
{
string_array_t* pkg_info = &minfo->package_info;
- const char* needed_vars = dictionary_get(pkg_info, "pkg.make.needed-vars", "true");
+ const char* needed_vars = dictionary_get_def(pkg_info, "pkg.make.needed-vars", "true");
char* key = print_string("pkg.make.needed-vars.%s", variable);
- const char* needed_var = dictionary_get(pkg_info, key, needed_vars);
+ const char* needed_var = dictionary_get_def(pkg_info, key, needed_vars);
free(key);
if ( !parse_boolean(needed_var) )
return;
@@ -398,25 +396,25 @@ void SetNeededVariables(metainfo_t* minfo)
SetNeedVariableCrossTool(minfo, "STRIP", "strip");
}
-void Configure(metainfo_t* minfo, const char* subdir = NULL)
+void Configure(metainfo_t* minfo, const char* subdir)
{
if ( fork_and_wait_or_recovery() )
{
string_array_t* pkg_info = &minfo->package_info;
const char* configure_raw =
- dictionary_get(pkg_info, "pkg.configure.cmd", "./configure");
+ dictionary_get_def(pkg_info, "pkg.configure.cmd", "./configure");
char* configure;
if ( strcmp(minfo->build_dir, minfo->package_dir) == 0 )
configure = strdup(configure_raw);
else
configure = print_string("%s/%s", minfo->package_dir, configure_raw);
const char* conf_extra_args =
- dictionary_get(pkg_info, "pkg.configure.args", "");
+ dictionary_get_def(pkg_info, "pkg.configure.args", "");
const char* conf_extra_vars =
- dictionary_get(pkg_info, "pkg.configure.vars", "");
+ dictionary_get_def(pkg_info, "pkg.configure.vars", "");
bool with_sysroot =
- parse_boolean(dictionary_get(pkg_info, "pkg.configure.with-sysroot",
- "false"));
+ parse_boolean(dictionary_get_def(pkg_info, "pkg.configure.with-sysroot",
+ "false"));
// After releasing Sortix 1.0, remove this and hard-code the default to
// false. This allows building Sortix 0.9 with its own ports using this
// tix-build version.
@@ -425,11 +423,11 @@ void Configure(metainfo_t* minfo, const char* subdir = NULL)
!strcmp(minfo->package_name, "gcc") )
with_sysroot_ld_bug_default = "true";
bool with_sysroot_ld_bug =
- parse_boolean(dictionary_get(pkg_info, "pkg.configure.with-sysroot-ld-bug",
- with_sysroot_ld_bug_default ));
+ parse_boolean(dictionary_get_def(pkg_info, "pkg.configure.with-sysroot-ld-bug",
+ with_sysroot_ld_bug_default ));
bool with_build_sysroot =
- parse_boolean(dictionary_get(pkg_info, "pkg.configure.with-build-sysroot",
- "false"));
+ parse_boolean(dictionary_get_def(pkg_info, "pkg.configure.with-build-sysroot",
+ "false"));
if ( chdir(minfo->build_dir) != 0 )
error(1, errno, "chdir: `%s'", minfo->build_dir);
if ( subdir && chdir(subdir) != 0 )
@@ -509,7 +507,7 @@ bool TestDirty(metainfo_t* minfo,
return result;
}
-bool IsDirty(metainfo_t* minfo, const char* subdir = NULL)
+bool IsDirty(metainfo_t* minfo, const char* subdir)
{
string_array_t* pkg_info = &minfo->package_info;
const char* dirty_file = dictionary_get(pkg_info, "pkg.dirty-file");
@@ -520,18 +518,17 @@ bool IsDirty(metainfo_t* minfo, const char* subdir = NULL)
TestDirty(minfo, subdir, "makefile");
}
-void Make(metainfo_t* minfo, const char* make_target,
- const char* destdir = NULL, bool die_on_error = true,
- const char* subdir = NULL)
+void Make(metainfo_t* minfo, const char* make_target, const char* destdir,
+ bool die_on_error, const char* subdir)
{
- if ( (!die_on_error && fork_and_wait_or_death(die_on_error)) ||
+ if ( (!die_on_error && fork_and_wait_or_death_def(die_on_error)) ||
(die_on_error && fork_and_wait_or_recovery()) )
{
string_array_t* pkg_info = &minfo->package_info;
char* make = strdup(minfo->make);
const char* override_make = dictionary_get(pkg_info, "pkg.make.cmd");
- const char* make_extra_args = dictionary_get(pkg_info, "pkg.make.args", "");
- const char* make_extra_vars = dictionary_get(pkg_info, "pkg.make.vars", "");
+ const char* make_extra_args = dictionary_get_def(pkg_info, "pkg.make.args", "");
+ const char* make_extra_vars = dictionary_get_def(pkg_info, "pkg.make.vars", "");
if ( override_make )
{
free(make);
@@ -605,7 +602,7 @@ void BuildPackage(metainfo_t* minfo)
// Determine whether need to do an out-of-directory build.
const char* use_build_dir_var =
- dictionary_get(pinfo, "pkg.configure.use-build-directory", "false");
+ dictionary_get_def(pinfo, "pkg.configure.use-build-directory", "false");
bool use_build_dir = parse_boolean(use_build_dir_var);
if ( use_build_dir )
{
@@ -620,18 +617,18 @@ void BuildPackage(metainfo_t* minfo)
// Reset the build directory if needed.
const char* default_clean_target =
!strcmp(build_system, "configure") ? "distclean" : "clean";
- const char* clean_target = dictionary_get(pinfo, "pkg.make.clean-target",
- default_clean_target);
+ const char* clean_target = dictionary_get_def(pinfo, "pkg.make.clean-target",
+ default_clean_target);
const char* ignore_clean_failure_var =
- dictionary_get(pinfo, "pkg.make.ignore-clean-failure", "true");
+ dictionary_get_def(pinfo, "pkg.make.ignore-clean-failure", "true");
bool ignore_clean_failure = parse_boolean(ignore_clean_failure_var);
- const char* subdir = dictionary_get(pinfo, "pkg.subdir", NULL);
+ const char* subdir = dictionary_get(pinfo, "pkg.subdir");
if ( SHOULD_DO_BUILD_STEP(BUILD_STEP_PRE_CLEAN, minfo) &&
!use_build_dir &&
- IsDirty(minfo) )
- Make(minfo, clean_target, NULL, !ignore_clean_failure);
+ IsDirty(minfo, NULL) )
+ Make(minfo, clean_target, NULL, !ignore_clean_failure, NULL);
// Configure the build directory if needed.
if ( strcmp(build_system, "configure") == 0 &&
@@ -639,10 +636,10 @@ void BuildPackage(metainfo_t* minfo)
Configure(minfo, subdir);
bool location_independent =
- parse_boolean(dictionary_get(pinfo, "pkg.location-independent", "false"));
+ parse_boolean(dictionary_get_def(pinfo, "pkg.location-independent", "false"));
- const char* build_target = dictionary_get(pinfo, "pkg.make.build-target", "all");
- const char* install_target = dictionary_get(pinfo, "pkg.make.install-target", "install");
+ const char* build_target = dictionary_get_def(pinfo, "pkg.make.build-target", "all");
+ const char* install_target = dictionary_get_def(pinfo, "pkg.make.install-target", "install");
if ( !location_independent && !minfo->prefix )
error(1, 0, "error: %s is not location independent and you need to "
@@ -770,7 +767,7 @@ void BuildPackage(metainfo_t* minfo)
// Clean the build directory after the successful build.
if ( SHOULD_DO_BUILD_STEP(BUILD_STEP_POST_CLEAN, minfo) )
- Make(minfo, clean_target, NULL, !ignore_clean_failure);
+ Make(minfo, clean_target, NULL, !ignore_clean_failure, NULL);
}
void VerifySourceTixInformation(metainfo_t* minfo)
@@ -797,7 +794,7 @@ void VerifySourceTixInformation(metainfo_t* minfo)
// but instead consider them normal characters. This should work as
// expected, though, as long as the MAKEFLAGS variable doesn't contain any
// quote characters.
-void PurifyMakeflags()
+void PurifyMakeflags(void)
{
const char* makeflags_environment = getenv("MAKEFLAGS");
if ( !makeflags_environment )
@@ -872,7 +869,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
@@ -979,7 +977,8 @@ int main(int argc, char* argv[])
minfo.package_info_path = print_string("%s/tixbuildinfo",
minfo.package_dir);
- string_array_t* package_info = &(minfo.package_info = string_array_make());
+ minfo.package_info = string_array_make();
+ string_array_t* package_info = &minfo.package_info;
if ( !dictionary_append_file_path(package_info, minfo.package_info_path) )
{
if ( errno == ENOENT )
diff --git a/tix/tix-collection.cpp b/tix/tix-collection.c
similarity index 98%
rename from tix/tix-collection.cpp
rename to tix/tix-collection.c
index 5df00d69..c8e8b6a3 100644
--- a/tix/tix-collection.cpp
+++ b/tix/tix-collection.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- tix-collection.cpp
+ tix-collection.c
Administer and configure a tix collection.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -36,6 +33,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -87,7 +85,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
diff --git a/tix/tix-execdiff.cpp b/tix/tix-execdiff.c
similarity index 97%
rename from tix/tix-execdiff.cpp
rename to tix/tix-execdiff.c
index 9f6e5460..771778ac 100644
--- a/tix/tix-execdiff.cpp
+++ b/tix/tix-execdiff.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- tix-execdiff.cpp
+ tix-execdiff.c
Reports which files have had the executable bit changed between two trees.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -37,6 +34,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -78,7 +76,8 @@ void execdiff(int tree_a, const char* tree_a_path,
DIR* dir_b = fdopendupdir(tree_b);
if ( !dir_b )
error(1, errno, "fdopendupdir(`%s`)", tree_b_path);
- while ( struct dirent* entry = readdir(dir_b) )
+ struct dirent* entry;
+ while ( (entry = readdir(dir_b)) )
{
if ( !strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") )
continue;
@@ -172,7 +171,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
diff --git a/tix/tix-execpatch.cpp b/tix/tix-execpatch.c
similarity index 98%
rename from tix/tix-execpatch.cpp
rename to tix/tix-execpatch.c
index d8a1160b..b6a0cb83 100644
--- a/tix/tix-execpatch.cpp
+++ b/tix/tix-execpatch.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- tix-execpatch.cpp
+ tix-execpatch.c
Patches the executable bits of files in the current source directory.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -38,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -203,7 +201,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
case 'c': check = true; break;
default:
diff --git a/tix/tix-install.cpp b/tix/tix-install.c
similarity index 98%
rename from tix/tix-install.cpp
rename to tix/tix-install.c
index 59fe175a..072ce072 100644
--- a/tix/tix-install.cpp
+++ b/tix/tix-install.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- tix-install.cpp
+ tix-install.c
Install a tix into a tix collection.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -38,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -177,7 +175,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
diff --git a/tix/tix-rmpatch.cpp b/tix/tix-rmpatch.c
similarity index 97%
rename from tix/tix-rmpatch.cpp
rename to tix/tix-rmpatch.c
index af5a8cae..b0d4bdfb 100644
--- a/tix/tix-rmpatch.cpp
+++ b/tix/tix-rmpatch.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- tix-rmpatch.cpp
+ tix-rmpatch.c
Removes files from the current source directory.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -38,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -140,7 +138,8 @@ bool rmpatch(FILE* input, const char* input_path, bool check)
error(1, errno, "%s:%zu: unexpected path with ..", input_path, line);
if ( check )
continue;
- if ( pid_t child_pid = fork_or_death() )
+ pid_t child_pid;
+ if ( (child_pid = fork_or_death()) )
{
int status;
waitpid(child_pid, &status, 0);
@@ -196,7 +195,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
case 'c': check = true; break;
default:
diff --git a/tix/tix.cpp b/tix/tix.c
similarity index 97%
rename from tix/tix.cpp
rename to tix/tix.c
index 872fb177..66461454 100644
--- a/tix/tix.cpp
+++ b/tix/tix.c
@@ -17,14 +17,11 @@
You should have received a copy of the GNU General Public License along with
Tix. If not, see .
- tix.cpp
+ tix.c
Front end to the Tix package management system.
*******************************************************************************/
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
#include
#include
#include
@@ -38,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -110,7 +108,7 @@ string_array_t GetPackageDependencies(params_t* params, const char* pkg_name)
VerifyTixInformation(&tixinfo, pkg_path);
- const char* deps = dictionary_get(&tixinfo, "pkg.runtime-deps", "");
+ const char* deps = dictionary_get_def(&tixinfo, "pkg.runtime-deps", "");
string_array_append_token_string(&ret, deps);
string_array_reset(&tixinfo);
@@ -193,7 +191,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
- while ( char c = *++arg ) switch ( c )
+ char c;
+ while ( (c = *++arg) ) switch ( c )
{
default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
diff --git a/tix/util.h b/tix/util.h
index a553d6ec..d46fac54 100644
--- a/tix/util.h
+++ b/tix/util.h
@@ -84,7 +84,7 @@ typedef struct
size_t capacity;
} string_array_t;
-string_array_t string_array_make()
+string_array_t string_array_make(void)
{
string_array_t sa;
sa.strings = NULL;
@@ -306,14 +306,19 @@ const char* dictionary_get_entry(string_array_t* sa, const char* key)
return sa->strings[index];
}
-const char* dictionary_get(string_array_t* sa, const char* key,
- const char* def = NULL)
+const char* dictionary_get_def(string_array_t* sa, const char* key,
+ const char* def)
{
size_t keylen = strlen(key);
const char* entry = dictionary_get_entry(sa, key);
return entry ? entry + keylen + 1 : def;
}
+const char* dictionary_get(string_array_t* sa, const char* key)
+{
+ return dictionary_get_def(sa, key, NULL);
+}
+
void dictionary_normalize_entry(char* entry)
{
bool key = true;
@@ -383,7 +388,7 @@ char* read_single_line(FILE* fp)
return ret;
}
-pid_t fork_or_death()
+pid_t fork_or_death(void)
{
pid_t child_pid = fork();
if ( child_pid < 0 )
@@ -391,7 +396,7 @@ pid_t fork_or_death()
return child_pid;
}
-void waitpid_or_death(pid_t child_pid, bool die_on_error = true)
+void waitpid_or_death_def(pid_t child_pid, bool die_on_error)
{
int status;
waitpid(child_pid, &status, 0);
@@ -406,15 +411,25 @@ void waitpid_or_death(pid_t child_pid, bool die_on_error = true)
}
}
-bool fork_and_wait_or_death(bool die_on_error = true)
+void waitpid_or_death(pid_t child_pid)
+{
+ return waitpid_or_death_def(child_pid, true);
+}
+
+bool fork_and_wait_or_death_def(bool die_on_error)
{
pid_t child_pid = fork_or_death();
if ( !child_pid )
return true;
- waitpid_or_death(child_pid, die_on_error);
+ waitpid_or_death_def(child_pid, die_on_error);
return false;
}
+bool fork_and_wait_or_death(void)
+{
+ return fork_and_wait_or_death_def(true);
+}
+
const char* getenv_def(const char* var, const char* def)
{
const char* ret = getenv(var);
@@ -443,7 +458,7 @@ static void compact_arguments(int* argc, char*** argv)
}
}
-char* GetBuildTriplet()
+char* GetBuildTriplet(void)
{
#if defined(__sortix__) && defined(__i386__)
return strdup("i486-sortix");
@@ -767,13 +782,14 @@ void VerifyTixCollectionConfiguration(string_array_t* info, const char* path)
static pid_t original_pid;
__attribute__((constructor))
-static void initialize_original_pid()
+static void initialize_original_pid(void)
{
original_pid = getpid();
}
-void cleanup_file_or_directory(int, void* path_ptr)
+void cleanup_file_or_directory(int status, void* path_ptr)
{
+ (void) status;
if ( original_pid != getpid() )
return;
pid_t pid = fork();
@@ -800,7 +816,7 @@ void cleanup_file_or_directory(int, void* path_ptr)
waitpid(pid, &code, 0);
}
-mode_t get_umask_value()
+mode_t get_umask_value(void)
{
mode_t result = umask(0);
umask(result);
@@ -859,8 +875,7 @@ enum recovery_state
};
enum recovery_state
-recovery_configure_state(bool set,
- enum recovery_state to_what = RECOVERY_STATE_NONE)
+recovery_configure_state_def(bool set, enum recovery_state to_what)
{
static enum recovery_state recovery_state = RECOVERY_STATE_NONE;
if ( set )
@@ -868,7 +883,13 @@ recovery_configure_state(bool set,
return recovery_state;
}
-bool recovery_print_attempted_execution()
+enum recovery_state
+recovery_configure_state(bool set)
+{
+ return recovery_configure_state_def(set, RECOVERY_STATE_NONE);
+}
+
+bool recovery_print_attempted_execution(void)
{
pid_t child_pid = fork();
if ( child_pid < 0 )
@@ -887,7 +908,7 @@ bool recovery_print_attempted_execution()
close(dev_null);
}
- recovery_configure_state(true, RECOVERY_STATE_PRINT_COMMAND);
+ recovery_configure_state_def(true, RECOVERY_STATE_PRINT_COMMAND);
return true;
}
@@ -897,7 +918,7 @@ bool recovery_print_attempted_execution()
return false;
}
-bool recovery_run_shell()
+bool recovery_run_shell(void)
{
pid_t child_pid = fork();
if ( child_pid < 0 )
@@ -905,7 +926,7 @@ bool recovery_run_shell()
if ( !child_pid )
{
- recovery_configure_state(true, RECOVERY_STATE_RUN_SHELL);
+ recovery_configure_state_def(true, RECOVERY_STATE_RUN_SHELL);
return true;
}
@@ -963,7 +984,7 @@ int recovery_execvp(const char* path, char* const* argv)
__builtin_unreachable();
}
-bool fork_and_wait_or_recovery()
+bool fork_and_wait_or_recovery(void)
{
int default_selection = 1;