@@ -1159,24 +1159,35 @@ fio_stat(char const* path, struct stat* st, bool follow_symlink, fio_location lo
1159
1159
bool
1160
1160
fio_is_same_file (char const * filename1 , char const * filename2 , bool follow_symlink , fio_location location )
1161
1161
{
1162
+ char * abs_name1 = make_absolute_path (filename1 );
1163
+ char * abs_name2 = make_absolute_path (filename2 );
1164
+ bool result = strcmp (abs_name1 , abs_name2 ) == 0 ;
1165
+
1162
1166
#ifndef WIN32
1163
- struct stat stat1 , stat2 ;
1167
+ if (!result )
1168
+ {
1169
+ struct stat stat1 , stat2 ;
1164
1170
1165
- if (fio_stat (filename1 , & stat1 , follow_symlink , location ) < 0 )
1166
- elog (ERROR , "Can't stat file \"%s\": %s" , filename1 , strerror (errno ));
1171
+ if (fio_stat (filename1 , & stat1 , follow_symlink , location ) < 0 )
1172
+ {
1173
+ if (errno == ENOENT )
1174
+ return false;
1175
+ elog (ERROR , "Can't stat file \"%s\": %s" , filename1 , strerror (errno ));
1176
+ }
1167
1177
1168
- if (fio_stat (filename2 , & stat2 , follow_symlink , location ) < 0 )
1169
- elog (ERROR , "Can't stat file \"%s\": %s" , filename2 , strerror (errno ));
1178
+ if (fio_stat (filename2 , & stat2 , follow_symlink , location ) < 0 )
1179
+ {
1180
+ if (errno == ENOENT )
1181
+ return false;
1182
+ elog (ERROR , "Can't stat file \"%s\": %s" , filename2 , strerror (errno ));
1183
+ }
1170
1184
1171
- return stat1 .st_ino == stat2 .st_ino && stat1 .st_dev == stat2 .st_dev ;
1172
- #else
1173
- char * abs_name1 = make_absolute_path (filename1 );
1174
- char * abs_name2 = make_absolute_path (filename2 );
1175
- bool result = strcmp (abs_name1 , abs_name2 ) == 0 ;
1185
+ result = (stat1 .st_ino == stat2 .st_ino && stat1 .st_dev == stat2 .st_dev );
1186
+ }
1187
+ #endif
1176
1188
free (abs_name2 );
1177
1189
free (abs_name1 );
1178
1190
return result ;
1179
- #endif
1180
1191
}
1181
1192
1182
1193
/*
0 commit comments