Explicitly close file descritpros on exit.
This is especially important now that the program could be a child process and the file descriptor could be open between a parent process.
data.process_pipe = F_true;
}
- if (F_status_is_error(byte_dump_main(arguments, &data))) {
+ const f_status_t status = byte_dump_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#ifndef _control_h
// libc includes
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(control_main(arguments, &data))) {
+ const f_status_t status = control_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
data.pid = getpid();
- if (F_status_is_error(controller_main(arguments, &data))) {
+ const f_status_t status = controller_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
f_signal_close(&data.signal);
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
if (F_status_is_error(status)) {
return 1;
}
#include <dirent.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_basic_list_read_main(arguments, &data))) {
+ const f_status_t status = fss_basic_list_read_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_basic_list_write_main(arguments, &data))) {
+ const f_status_t status = fss_basic_list_write_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_basic_read_main(arguments, &data))) {
+ const f_status_t status = fss_basic_read_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_basic_write_main(arguments, &data))) {
+ const f_status_t status = fss_basic_write_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_embedded_list_read_main(arguments, &data))) {
+ const f_status_t status = fss_embedded_list_read_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_embedded_list_write_main(arguments, &data))) {
+ const f_status_t status = fss_embedded_list_write_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_extended_list_read_main(arguments, &data))) {
+ const f_status_t status = fss_extended_list_read_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_extended_list_write_main(arguments, &data))) {
+ const f_status_t status = fss_extended_list_write_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_extended_read_main(arguments, &data))) {
+ const f_status_t status = fss_extended_read_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(fss_extended_write_main(arguments, &data))) {
+ const f_status_t status = fss_extended_write_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
const f_status_t status = fss_status_code_main(arguments, &data);
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
if (F_status_is_error(status) || status == F_false) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(iki_read_main(arguments, &data))) {
+ const f_status_t status = iki_read_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
data.process_pipe = F_true;
}
- if (F_status_is_error(iki_write_main(arguments, &data))) {
+ const f_status_t status = iki_write_main(arguments, &data);
+
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
+ if (F_status_is_error(status)) {
return 1;
}
// libc includes
#include <sys/mount.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>
int main(const unsigned long argc, const f_string_t *argv) {
const f_console_arguments_t arguments = { argc, argv };
init_data_t data = init_data_initialize;
- f_status_t status = F_none;
f_signal_set_empty(&data.signal.set);
f_signal_set_add(F_signal_abort, &data.signal.set);
// restore umask.
umask(data.umask);
- status = init_main(arguments, &data);
+ const f_status_t status = init_main(arguments, &data);
f_signal_close(&data.signal);
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
if (F_status_is_error(status)) {
return 1;
}
const f_status_t status = status_code_main(arguments, &data);
+ // close all open file descriptors.
+ close(f_type_descriptor_output);
+ close(f_type_descriptor_input);
+ close(f_type_descriptor_error);
+
if (F_status_is_error(status) || status == F_false) {
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// fll-0 includes
#include <level_0/type.h>