@@ -49,8 +49,7 @@ get_map_ranges(int ranges, int argc, char **argv)
4949
5050 mappings = calloc_T (ranges , struct map_range );
5151 if (!mappings ) {
52- fprintf (log_get_logfd (), _ ( "%s: Memory allocation failure\n" ),
53- log_get_progname ());
52+ fprinte (log_get_logfd (), "%s: calloc:" , log_get_progname ());
5453 return NULL ;
5554 }
5655
@@ -150,12 +149,12 @@ void write_mapping(int proc_dir_fd, int ranges, const struct map_range *mappings
150149 /* Align setuid- and fscaps-based new{g,u}idmap behavior. */
151150 if (geteuid () == 0 && geteuid () != ruid ) {
152151 if (prctl (PR_SET_KEEPCAPS , 1L ) == -1 ) {
153- fprintf (log_get_logfd (), _ ( "%s: Could not prctl(PR_SET_KEEPCAPS)\n" ) , log_get_progname ());
152+ fprinte (log_get_logfd (), "%s: prctl(PR_SET_KEEPCAPS)" , log_get_progname ());
154153 exit (EXIT_FAILURE );
155154 }
156155
157- if (seteuid (ruid ) < 0 ) {
158- fprintf (log_get_logfd (), _ ( "%s: Could not seteuid to %d\n" ) , log_get_progname (), ruid );
156+ if (seteuid (ruid ) == -1 ) {
157+ fprinte (log_get_logfd (), "%s: seteuid(%d)" , log_get_progname (), ruid );
159158 exit (EXIT_FAILURE );
160159 }
161160 }
@@ -170,8 +169,8 @@ void write_mapping(int proc_dir_fd, int ranges, const struct map_range *mappings
170169 if (maps_lower_root (cap , ranges , mappings ))
171170 data [0 ].effective |= CAP_TO_MASK (CAP_SETFCAP );
172171 data [0 ].permitted = data [0 ].effective ;
173- if (capset (& hdr , data ) < 0 ) {
174- fprintf (log_get_logfd (), _ ( "%s: Could not set caps\n" ) , log_get_progname ());
172+ if (capset (& hdr , data ) == -1 ) {
173+ fprinte (log_get_logfd (), "%s: capset" , log_get_progname ());
175174 exit (EXIT_FAILURE );
176175 }
177176#endif
@@ -190,24 +189,24 @@ void write_mapping(int proc_dir_fd, int ranges, const struct map_range *mappings
190189 mapping -> count );
191190 }
192191 if (pos == end || pos == NULL ) {
193- fprintf (log_get_logfd (), _ ( "%s: seprintf failed!\n" ) , log_get_progname ());
192+ fprinte (log_get_logfd (), "%s: seprintf" , log_get_progname ());
194193 exit (EXIT_FAILURE );
195194 }
196195
197196 /* Write the mapping to the mapping file */
198197 fd = openat (proc_dir_fd , map_file , O_WRONLY );
199- if (fd < 0 ) {
200- fprinte (log_get_logfd (), _ ( "%s: open of %s failed" ) ,
198+ if (fd == -1 ) {
199+ fprinte (log_get_logfd (), "%s: openat(%s)" ,
201200 log_get_progname (), map_file );
202201 exit (EXIT_FAILURE );
203202 }
204203 if (write_full (fd , buf , pos - buf ) == -1 ) {
205- fprinte (log_get_logfd (), _ ( "%s: write to %s failed" ) ,
204+ fprinte (log_get_logfd (), "%s: write(\"%s\")" ,
206205 log_get_progname (), map_file );
207206 exit (EXIT_FAILURE );
208207 }
209- if (close (fd ) != 0 && errno != EINTR ) {
210- fprinte (log_get_logfd (), _ ( "%s: closing %s failed" ) ,
208+ if (close (fd ) == -1 && errno != EINTR ) {
209+ fprinte (log_get_logfd (), "%s: close(\"%s\")" ,
211210 log_get_progname (), map_file );
212211 exit (EXIT_FAILURE );
213212 }
0 commit comments