diff options
author | ng0 <ng0@n0.is> | 2019-09-06 22:46:29 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-06 22:46:29 +0000 |
commit | 6e599264ad13e8fc105493d74d7c11d46f8739ed (patch) | |
tree | 169bef1ecbade5a659831fb169f3ae6943af127f /src/util/os_installation.c | |
parent | 4f13bc15113021ebf71d5d81e99bc29f8a07fc9c (diff) | |
download | gnunet-6e599264ad13e8fc105493d74d7c11d46f8739ed.tar.gz gnunet-6e599264ad13e8fc105493d74d7c11d46f8739ed.zip |
first step to remove plibc
Diffstat (limited to 'src/util/os_installation.c')
-rw-r--r-- | src/util/os_installation.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 8dacd431d..3e5a99811 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -107,7 +107,7 @@ GNUNET_OS_project_data_get () | |||
107 | { | 107 | { |
108 | char *path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR); | 108 | char *path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR); |
109 | if (NULL != path) | 109 | if (NULL != path) |
110 | BINDTEXTDOMAIN (PACKAGE, path); | 110 | bindtextdomain (PACKAGE, path); |
111 | GNUNET_free (path); | 111 | GNUNET_free (path); |
112 | gettextinit = 1; | 112 | gettextinit = 1; |
113 | } | 113 | } |
@@ -127,7 +127,7 @@ GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd) | |||
127 | { | 127 | { |
128 | char *path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR); | 128 | char *path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR); |
129 | if (NULL != path) | 129 | if (NULL != path) |
130 | BINDTEXTDOMAIN (PACKAGE, path); | 130 | bindtextdomain (PACKAGE, path); |
131 | GNUNET_free (path); | 131 | GNUNET_free (path); |
132 | gettextinit = 1; | 132 | gettextinit = 1; |
133 | } | 133 | } |
@@ -152,7 +152,7 @@ get_path_from_proc_maps () | |||
152 | char *lgu; | 152 | char *lgu; |
153 | 153 | ||
154 | GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/maps", getpid ()); | 154 | GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/maps", getpid ()); |
155 | if (NULL == (f = FOPEN (fn, "r"))) | 155 | if (NULL == (f = fopen (fn, "r"))) |
156 | return NULL; | 156 | return NULL; |
157 | while (NULL != fgets (line, sizeof (line), f)) | 157 | while (NULL != fgets (line, sizeof (line), f)) |
158 | { | 158 | { |
@@ -162,11 +162,11 @@ get_path_from_proc_maps () | |||
162 | (NULL != (lgu = strstr (dir, current_pd->libname)))) | 162 | (NULL != (lgu = strstr (dir, current_pd->libname)))) |
163 | { | 163 | { |
164 | lgu[0] = '\0'; | 164 | lgu[0] = '\0'; |
165 | FCLOSE (f); | 165 | fclose (f); |
166 | return GNUNET_strdup (dir); | 166 | return GNUNET_strdup (dir); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | FCLOSE (f); | 169 | fclose (f); |
170 | return NULL; | 170 | return NULL; |
171 | } | 171 | } |
172 | 172 | ||
@@ -666,7 +666,7 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind) | |||
666 | { | 666 | { |
667 | GNUNET_asprintf (&dirname, | 667 | GNUNET_asprintf (&dirname, |
668 | DIR_SEPARATOR_STR "lib32" DIR_SEPARATOR_STR | 668 | DIR_SEPARATOR_STR "lib32" DIR_SEPARATOR_STR |
669 | "%s" DIR_SEPARATOR_STR, | 669 | "%s" DIR_SEPARATOR_STR, |
670 | current_pd->project_dirname); | 670 | current_pd->project_dirname); |
671 | GNUNET_asprintf (&tmp, "%s%s", execpath, dirname); | 671 | GNUNET_asprintf (&tmp, "%s%s", execpath, dirname); |
672 | } | 672 | } |
@@ -674,7 +674,7 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind) | |||
674 | { | 674 | { |
675 | GNUNET_asprintf (&dirname, | 675 | GNUNET_asprintf (&dirname, |
676 | DIR_SEPARATOR_STR "lib64" DIR_SEPARATOR_STR | 676 | DIR_SEPARATOR_STR "lib64" DIR_SEPARATOR_STR |
677 | "%s" DIR_SEPARATOR_STR, | 677 | "%s" DIR_SEPARATOR_STR, |
678 | current_pd->project_dirname); | 678 | current_pd->project_dirname); |
679 | GNUNET_asprintf (&tmp, "%s%s", execpath, dirname); | 679 | GNUNET_asprintf (&tmp, "%s%s", execpath, dirname); |
680 | } | 680 | } |
@@ -696,22 +696,22 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind) | |||
696 | case GNUNET_OS_IPK_DATADIR: | 696 | case GNUNET_OS_IPK_DATADIR: |
697 | GNUNET_asprintf (&dirname, | 697 | GNUNET_asprintf (&dirname, |
698 | DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR | 698 | DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR |
699 | "%s" DIR_SEPARATOR_STR, | 699 | "%s" DIR_SEPARATOR_STR, |
700 | current_pd->project_dirname); | 700 | current_pd->project_dirname); |
701 | break; | 701 | break; |
702 | case GNUNET_OS_IPK_LOCALEDIR: | 702 | case GNUNET_OS_IPK_LOCALEDIR: |
703 | dirname = GNUNET_strdup (DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR | 703 | dirname = GNUNET_strdup (DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR |
704 | "locale" DIR_SEPARATOR_STR); | 704 | "locale" DIR_SEPARATOR_STR); |
705 | break; | 705 | break; |
706 | case GNUNET_OS_IPK_ICONDIR: | 706 | case GNUNET_OS_IPK_ICONDIR: |
707 | dirname = GNUNET_strdup (DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR | 707 | dirname = GNUNET_strdup (DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR |
708 | "icons" DIR_SEPARATOR_STR); | 708 | "icons" DIR_SEPARATOR_STR); |
709 | break; | 709 | break; |
710 | case GNUNET_OS_IPK_DOCDIR: | 710 | case GNUNET_OS_IPK_DOCDIR: |
711 | GNUNET_asprintf (&dirname, | 711 | GNUNET_asprintf (&dirname, |
712 | DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR | 712 | DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR |
713 | "doc" DIR_SEPARATOR_STR | 713 | "doc" DIR_SEPARATOR_STR |
714 | "%s" DIR_SEPARATOR_STR, | 714 | "%s" DIR_SEPARATOR_STR, |
715 | current_pd->project_dirname); | 715 | current_pd->project_dirname); |
716 | break; | 716 | break; |
717 | case GNUNET_OS_IPK_LIBEXECDIR: | 717 | case GNUNET_OS_IPK_LIBEXECDIR: |
@@ -719,7 +719,7 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind) | |||
719 | { | 719 | { |
720 | GNUNET_asprintf (&dirname, | 720 | GNUNET_asprintf (&dirname, |
721 | DIR_SEPARATOR_STR "%s" DIR_SEPARATOR_STR | 721 | DIR_SEPARATOR_STR "%s" DIR_SEPARATOR_STR |
722 | "libexec" DIR_SEPARATOR_STR, | 722 | "libexec" DIR_SEPARATOR_STR, |
723 | current_pd->project_dirname); | 723 | current_pd->project_dirname); |
724 | GNUNET_asprintf (&tmp, | 724 | GNUNET_asprintf (&tmp, |
725 | "%s%s%s%s", | 725 | "%s%s%s%s", |
@@ -740,8 +740,8 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind) | |||
740 | { | 740 | { |
741 | GNUNET_asprintf (&dirname, | 741 | GNUNET_asprintf (&dirname, |
742 | DIR_SEPARATOR_STR "lib32" DIR_SEPARATOR_STR | 742 | DIR_SEPARATOR_STR "lib32" DIR_SEPARATOR_STR |
743 | "%s" DIR_SEPARATOR_STR | 743 | "%s" DIR_SEPARATOR_STR |
744 | "libexec" DIR_SEPARATOR_STR, | 744 | "libexec" DIR_SEPARATOR_STR, |
745 | current_pd->project_dirname); | 745 | current_pd->project_dirname); |
746 | GNUNET_asprintf (&tmp, "%s%s", execpath, dirname); | 746 | GNUNET_asprintf (&tmp, "%s%s", execpath, dirname); |
747 | } | 747 | } |
@@ -749,8 +749,8 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind) | |||
749 | { | 749 | { |
750 | GNUNET_asprintf (&dirname, | 750 | GNUNET_asprintf (&dirname, |
751 | DIR_SEPARATOR_STR "lib64" DIR_SEPARATOR_STR | 751 | DIR_SEPARATOR_STR "lib64" DIR_SEPARATOR_STR |
752 | "%s" DIR_SEPARATOR_STR | 752 | "%s" DIR_SEPARATOR_STR |
753 | "libexec" DIR_SEPARATOR_STR, | 753 | "libexec" DIR_SEPARATOR_STR, |
754 | current_pd->project_dirname); | 754 | current_pd->project_dirname); |
755 | GNUNET_asprintf (&tmp, "%s%s", execpath, dirname); | 755 | GNUNET_asprintf (&tmp, "%s%s", execpath, dirname); |
756 | } | 756 | } |
@@ -766,7 +766,7 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind) | |||
766 | } | 766 | } |
767 | GNUNET_asprintf (&dirname, | 767 | GNUNET_asprintf (&dirname, |
768 | DIR_SEPARATOR_STR "%s" DIR_SEPARATOR_STR | 768 | DIR_SEPARATOR_STR "%s" DIR_SEPARATOR_STR |
769 | "libexec" DIR_SEPARATOR_STR, | 769 | "libexec" DIR_SEPARATOR_STR, |
770 | current_pd->project_dirname); | 770 | current_pd->project_dirname); |
771 | break; | 771 | break; |
772 | default: | 772 | default: |
@@ -844,14 +844,14 @@ GNUNET_OS_get_suid_binary_path (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
844 | "PATHS", | 844 | "PATHS", |
845 | "SUID_BINARY_PATH", | 845 | "SUID_BINARY_PATH", |
846 | &path); | 846 | &path); |
847 | if ((NULL == path)||(0 == strlen (path))) | 847 | if ((NULL == path) || (0 == strlen (path))) |
848 | return GNUNET_OS_get_libexec_binary_path (progname); | 848 | return GNUNET_OS_get_libexec_binary_path (progname); |
849 | path_len = strlen (path); | 849 | path_len = strlen (path); |
850 | GNUNET_asprintf (&binary, | 850 | GNUNET_asprintf (&binary, |
851 | "%s%s%s", | 851 | "%s%s%s", |
852 | path, | 852 | path, |
853 | (path[path_len - 1] == DIR_SEPARATOR) ? "" | 853 | (path[path_len - 1] == DIR_SEPARATOR) ? "" |
854 | : DIR_SEPARATOR_STR, | 854 | : DIR_SEPARATOR_STR, |
855 | progname); | 855 | progname); |
856 | cache = path; | 856 | cache = path; |
857 | return binary; | 857 | return binary; |
@@ -926,7 +926,7 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
926 | binary); | 926 | binary); |
927 | return GNUNET_SYSERR; | 927 | return GNUNET_SYSERR; |
928 | } | 928 | } |
929 | if (0 != ACCESS (p, X_OK)) | 929 | if (0 != access (p, X_OK)) |
930 | { | 930 | { |
931 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", p); | 931 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", p); |
932 | GNUNET_free (p); | 932 | GNUNET_free (p); |
@@ -940,7 +940,7 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
940 | return GNUNET_YES; | 940 | return GNUNET_YES; |
941 | } | 941 | } |
942 | #endif | 942 | #endif |
943 | if (0 != STAT (p, &statbuf)) | 943 | if (0 != stat (p, &statbuf)) |
944 | { | 944 | { |
945 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", p); | 945 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", p); |
946 | GNUNET_free (p); | 946 | GNUNET_free (p); |
@@ -973,16 +973,16 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
973 | 973 | ||
974 | // Start the child process. | 974 | // Start the child process. |
975 | if (! (CreateProcess ( | 975 | if (! (CreateProcess ( |
976 | p, // current windows (2k3 and up can handle / instead of \ in paths)) | 976 | p, // current windows (2k3 and up can handle / instead of \ in paths)) |
977 | parameters, // execute dryrun/priviliege checking mode | 977 | parameters, // execute dryrun/priviliege checking mode |
978 | NULL, // Process handle not inheritable | 978 | NULL, // Process handle not inheritable |
979 | NULL, // Thread handle not inheritable | 979 | NULL, // Thread handle not inheritable |
980 | FALSE, // Set handle inheritance to FALSE | 980 | FALSE, // Set handle inheritance to FALSE |
981 | CREATE_DEFAULT_ERROR_MODE, // No creation flags | 981 | CREATE_DEFAULT_ERROR_MODE, // No creation flags |
982 | NULL, // Use parent's environment block | 982 | NULL, // Use parent's environment block |
983 | NULL, // Use parent's starting directory | 983 | NULL, // Use parent's starting directory |
984 | &start, // Pointer to STARTUPINFO structure | 984 | &start, // Pointer to STARTUPINFO structure |
985 | &proc) // Pointer to PROCESS_INFORMATION structure | 985 | &proc) // Pointer to PROCESS_INFORMATION structure |
986 | )) | 986 | )) |
987 | { | 987 | { |
988 | LOG (GNUNET_ERROR_TYPE_ERROR, | 988 | LOG (GNUNET_ERROR_TYPE_ERROR, |