@@ -1067,7 +1067,7 @@ static int check_overwrite(const char *device)
10671067 * 1: something is wrong, an error is printed
10681068 * 0: all is fine
10691069 */
1070- int test_dev_for_mkfs (const char * file , int force_overwrite )
1070+ bool test_dev_for_mkfs (const char * file , int force_overwrite )
10711071{
10721072 int ret , fd ;
10731073 struct stat st ;
@@ -1076,64 +1076,64 @@ int test_dev_for_mkfs(const char *file, int force_overwrite)
10761076 if (ret < 0 ) {
10771077 errno = - ret ;
10781078 error ("checking status of %s: %m" , file );
1079- return 1 ;
1079+ return true ;
10801080 }
10811081 if (ret == 1 ) {
10821082 error ("%s is a swap device" , file );
1083- return 1 ;
1083+ return true ;
10841084 }
10851085 ret = test_status_for_mkfs (file , force_overwrite );
10861086 if (ret )
1087- return 1 ;
1087+ return true ;
10881088 /*
10891089 * Check if the device is busy. Open it in read-only mode to avoid triggering
10901090 * udev events.
10911091 */
10921092 fd = open (file , O_RDONLY | O_EXCL );
10931093 if (fd < 0 ) {
10941094 error ("unable to open %s: %m" , file );
1095- return 1 ;
1095+ return true ;
10961096 }
10971097 if (fstat (fd , & st )) {
10981098 error ("unable to stat %s: %m" , file );
10991099 close (fd );
1100- return 1 ;
1100+ return true ;
11011101 }
11021102 if (!S_ISBLK (st .st_mode )) {
11031103 error ("%s is not a block device" , file );
11041104 close (fd );
1105- return 1 ;
1105+ return true ;
11061106 }
11071107 close (fd );
1108- return 0 ;
1108+ return false ;
11091109}
11101110
11111111/*
11121112 * check if the file (device) is formatted or mounted
11131113 */
1114- int test_status_for_mkfs (const char * file , bool force_overwrite )
1114+ bool test_status_for_mkfs (const char * file , bool force_overwrite )
11151115{
11161116 int ret ;
11171117
11181118 if (!force_overwrite ) {
11191119 if (check_overwrite (file )) {
11201120 error ("use the -f option to force overwrite of %s" ,
11211121 file );
1122- return 1 ;
1122+ return true ;
11231123 }
11241124 }
11251125 ret = check_mounted (file );
11261126 if (ret < 0 ) {
11271127 errno = - ret ;
11281128 error ("cannot check mount status of %s: %m" , file );
1129- return 1 ;
1129+ return true ;
11301130 }
11311131 if (ret == 1 ) {
11321132 error ("%s is mounted" , file );
1133- return 1 ;
1133+ return true ;
11341134 }
11351135
1136- return 0 ;
1136+ return false ;
11371137}
11381138
11391139int is_vol_small (const char * file )
0 commit comments