@@ -5529,7 +5529,7 @@ MONO_RESTORE_WARNING
55295529
55305530 if (acfg -> aot_opts .export_symbols_outfile ) {
55315531 char * export_symbols_out = g_string_free (export_symbols , FALSE);
5532- FILE * export_symbols_outfile = fopen (acfg -> aot_opts .export_symbols_outfile , "w" );
5532+ FILE * export_symbols_outfile = g_fopen (acfg -> aot_opts .export_symbols_outfile , "w" );
55335533 if (!export_symbols_outfile ) {
55345534 fprintf (stderr , "Unable to open specified export_symbols_outfile '%s' to append symbols '%s': %s\n" , acfg -> aot_opts .export_symbols_outfile , export_symbols_out , strerror (errno ));
55355535 g_free (export_symbols_out );
@@ -13446,11 +13446,11 @@ compile_asm (MonoAotCompile *acfg)
1344613446 }
1344713447#endif
1344813448
13449- if (0 != rename (tmp_outfile_name , outfile_name )) {
13449+ if (0 != g_rename (tmp_outfile_name , outfile_name )) {
1345013450 if (G_FILE_ERROR_EXIST == g_file_error_from_errno (errno )) {
1345113451 /* Since we are rebuilding the module we need to be able to replace any old copies. Remove old file and retry rename operation. */
13452- unlink (outfile_name );
13453- rename (tmp_outfile_name , outfile_name );
13452+ g_unlink (outfile_name );
13453+ g_rename (tmp_outfile_name , outfile_name );
1345413454 }
1345513455 }
1345613456
@@ -13463,7 +13463,7 @@ compile_asm (MonoAotCompile *acfg)
1346313463#endif
1346413464
1346513465 if (!acfg -> aot_opts .save_temps )
13466- unlink (objfile );
13466+ g_unlink (objfile );
1346713467
1346813468 g_free (tmp_outfile_name );
1346913469 g_free (outfile_name );
@@ -13472,7 +13472,7 @@ compile_asm (MonoAotCompile *acfg)
1347213472 if (acfg -> aot_opts .save_temps )
1347313473 aot_printf (acfg , "Retained input file.\n" );
1347413474 else
13475- unlink (acfg -> tmpfname );
13475+ g_unlink (acfg -> tmpfname );
1347613476
1347713477 return 0 ;
1347813478}
@@ -13520,7 +13520,7 @@ load_profile_file (MonoAotCompile *acfg, char *filename)
1352013520 int version ;
1352113521 char magic [32 ];
1352213522
13523- infile = fopen (filename , "rb" );
13523+ infile = g_fopen (filename , "rb" );
1352413524 if (!infile ) {
1352513525 fprintf (stderr , "Unable to open file '%s': %s.\n" , filename , strerror (errno ));
1352613526 exit (1 );
@@ -14538,7 +14538,7 @@ static void aot_dump (MonoAotCompile *acfg)
1453814538 mono_json_writer_object_end (& writer );
1453914539
1454014540 dumpname = g_strdup_printf ("%s.json" , g_path_get_basename (acfg -> image -> name ));
14541- dumpfile = fopen (dumpname , "w+" );
14541+ dumpfile = g_fopen (dumpname , "w+" );
1454214542 g_free (dumpname );
1454314543
1454414544 fprintf (dumpfile , "%s" , writer .text -> str );
@@ -14947,7 +14947,7 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)
1494714947 }
1494814948
1494914949 if (acfg -> aot_opts .logfile ) {
14950- acfg -> logfile = fopen (acfg -> aot_opts .logfile , "a+" );
14950+ acfg -> logfile = g_fopen (acfg -> aot_opts .logfile , "a+" );
1495114951 }
1495214952
1495314953 if (acfg -> aot_opts .trimming_eligible_methods_outfile && acfg -> dedup_phase != DEDUP_COLLECT ) {
@@ -14961,7 +14961,7 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)
1496114961 }
1496214962
1496314963 if (acfg -> aot_opts .data_outfile ) {
14964- acfg -> data_outfile = fopen (acfg -> aot_opts .data_outfile , "w+" );
14964+ acfg -> data_outfile = g_fopen (acfg -> aot_opts .data_outfile , "w+" );
1496514965 if (!acfg -> data_outfile ) {
1496614966 aot_printerrf (acfg , "Unable to create file '%s': %s\n" , acfg -> aot_opts .data_outfile , strerror (errno ));
1496714967 return 1 ;
@@ -15124,7 +15124,7 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)
1512415124 acfg -> flags = (MonoAotFileFlags )(acfg -> flags | MONO_AOT_FILE_FLAG_EAGER_LOAD );
1512515125
1512615126 if (acfg -> aot_opts .instances_logfile_path ) {
15127- acfg -> instances_logfile = fopen (acfg -> aot_opts .instances_logfile_path , "w" );
15127+ acfg -> instances_logfile = g_fopen (acfg -> aot_opts .instances_logfile_path , "w" );
1512815128 if (!acfg -> instances_logfile ) {
1512915129 aot_printerrf (acfg , "Unable to create logfile: '%s'.\n" , acfg -> aot_opts .instances_logfile_path );
1513015130 return 1 ;
@@ -15387,7 +15387,7 @@ create_depfile (MonoAotCompile *acfg)
1538715387 // FIXME: Support other configurations
1538815388 g_assert (acfg -> aot_opts .llvm_only && acfg -> aot_opts .asm_only && acfg -> aot_opts .llvm_outfile );
1538915389
15390- depfile = fopen (acfg -> aot_opts .depfile , "w" );
15390+ depfile = g_fopen (acfg -> aot_opts .depfile , "w" );
1539115391 g_assert (depfile );
1539215392
1539315393 int ntargets = 1 ;
@@ -15459,14 +15459,14 @@ emit_aot_image (MonoAotCompile *acfg)
1545915459 acfg -> tmpfname = g_strdup_printf ("%s" , acfg -> aot_opts .outfile );
1546015460 else
1546115461 acfg -> tmpfname = g_strdup_printf ("%s.s" , acfg -> image -> name );
15462- acfg -> fp = fopen (acfg -> tmpfname , "w+" );
15462+ acfg -> fp = g_fopen (acfg -> tmpfname , "w+" );
1546315463 } else {
1546415464 if (strcmp (acfg -> aot_opts .temp_path , "" ) == 0 ) {
1546515465 acfg -> fp = fdopen (g_file_open_tmp ("mono_aot_XXXXXX" , & acfg -> tmpfname , NULL ), "w+" );
1546615466 } else {
1546715467 acfg -> tmpbasename = g_build_filename (acfg -> aot_opts .temp_path , "temp" , (const char * )NULL );
1546815468 acfg -> tmpfname = g_strdup_printf ("%s.s" , acfg -> tmpbasename );
15469- acfg -> fp = fopen (acfg -> tmpfname , "w+" );
15469+ acfg -> fp = g_fopen (acfg -> tmpfname , "w+" );
1547015470 }
1547115471 }
1547215472 if (acfg -> fp == 0 && !acfg -> aot_opts .llvm_only ) {
0 commit comments