@@ -387,7 +387,7 @@ static bool realpath_fd(int fd, std::string* realpath) {
387387 auto length = readlink (proc_self_fd, buf, sizeof (buf));
388388 if (length == -1 ) {
389389 if (!is_first_stage_init ()) {
390- PRINT (" readlink(\" %s\" ) failed: %s [fd=%d]" , proc_self_fd, strerror (errno) , fd);
390+ PRINT (" readlink(\" %s\" [fd=%d]) failed: %m " , proc_self_fd, fd);
391391 }
392392 return false ;
393393 }
@@ -1185,7 +1185,7 @@ static bool load_library(android_namespace_t* ns,
11851185
11861186 struct stat file_stat;
11871187 if (TEMP_FAILURE_RETRY (fstat (task->get_fd (), &file_stat)) != 0 ) {
1188- DL_OPEN_ERR (" unable to stat file for the library \" %s\" : %s " , name, strerror (errno) );
1188+ DL_OPEN_ERR (" unable to stat file for the library \" %s\" : %m " , name);
11891189 return false ;
11901190 }
11911191 if (file_offset >= file_stat.st_size ) {
@@ -1215,7 +1215,7 @@ static bool load_library(android_namespace_t* ns,
12151215
12161216 struct statfs fs_stat;
12171217 if (TEMP_FAILURE_RETRY (fstatfs (task->get_fd (), &fs_stat)) != 0 ) {
1218- DL_OPEN_ERR (" unable to fstatfs file for the library \" %s\" : %s " , name, strerror (errno) );
1218+ DL_OPEN_ERR (" unable to fstatfs file for the library \" %s\" : %m " , name);
12191219 return false ;
12201220 }
12211221
@@ -3364,7 +3364,7 @@ bool soinfo::link_image(const SymbolLookupList& lookup_list, soinfo* local_group
33643364 get_realpath ());
33653365 add_dlwarning (get_realpath (), " text relocations" );
33663366 if (phdr_table_unprotect_segments (phdr, phnum, load_bias, should_pad_segments_) < 0 ) {
3367- DL_ERR (" can't unprotect loadable segments for \" %s\" : %s " , get_realpath (), strerror (errno ));
3367+ DL_ERR (" can't unprotect loadable segments for \" %s\" : %m " , get_realpath ());
33683368 return false ;
33693369 }
33703370 }
@@ -3380,8 +3380,7 @@ bool soinfo::link_image(const SymbolLookupList& lookup_list, soinfo* local_group
33803380 if (has_text_relocations) {
33813381 // All relocations are done, we can protect our segments back to read-only.
33823382 if (phdr_table_protect_segments (phdr, phnum, load_bias, should_pad_segments_) < 0 ) {
3383- DL_ERR (" can't protect segments for \" %s\" : %s" ,
3384- get_realpath (), strerror (errno));
3383+ DL_ERR (" can't protect segments for \" %s\" : %m" , get_realpath ());
33853384 return false ;
33863385 }
33873386 }
@@ -3397,15 +3396,13 @@ bool soinfo::link_image(const SymbolLookupList& lookup_list, soinfo* local_group
33973396 if (extinfo && (extinfo->flags & ANDROID_DLEXT_WRITE_RELRO)) {
33983397 if (phdr_table_serialize_gnu_relro (phdr, phnum, load_bias,
33993398 extinfo->relro_fd , relro_fd_offset) < 0 ) {
3400- DL_ERR (" failed serializing GNU RELRO section for \" %s\" : %s" ,
3401- get_realpath (), strerror (errno));
3399+ DL_ERR (" failed serializing GNU RELRO section for \" %s\" : %m" , get_realpath ());
34023400 return false ;
34033401 }
34043402 } else if (extinfo && (extinfo->flags & ANDROID_DLEXT_USE_RELRO)) {
34053403 if (phdr_table_map_gnu_relro (phdr, phnum, load_bias,
34063404 extinfo->relro_fd , relro_fd_offset) < 0 ) {
3407- DL_ERR (" failed mapping GNU RELRO section for \" %s\" : %s" ,
3408- get_realpath (), strerror (errno));
3405+ DL_ERR (" failed mapping GNU RELRO section for \" %s\" : %m" , get_realpath ());
34093406 return false ;
34103407 }
34113408 }
@@ -3418,8 +3415,7 @@ bool soinfo::link_image(const SymbolLookupList& lookup_list, soinfo* local_group
34183415
34193416bool soinfo::protect_relro () {
34203417 if (phdr_table_protect_gnu_relro (phdr, phnum, load_bias, should_pad_segments_) < 0 ) {
3421- DL_ERR (" can't enable GNU RELRO protection for \" %s\" : %s" ,
3422- get_realpath (), strerror (errno));
3418+ DL_ERR (" can't enable GNU RELRO protection for \" %s\" : %m" , get_realpath ());
34233419 return false ;
34243420 }
34253421 return true ;
0 commit comments