@@ -1102,15 +1102,8 @@ _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th)
1102
1102
fatal ("could not close temporary file: %m" );
1103
1103
1104
1104
if (len != th -> fileLen )
1105
- {
1106
- char buf1 [32 ],
1107
- buf2 [32 ];
1108
-
1109
- snprintf (buf1 , sizeof (buf1 ), INT64_FORMAT , (int64 ) len );
1110
- snprintf (buf2 , sizeof (buf2 ), INT64_FORMAT , (int64 ) th -> fileLen );
1111
- fatal ("actual file length (%s) does not match expected (%s)" ,
1112
- buf1 , buf2 );
1113
- }
1105
+ fatal ("actual file length (%lld) does not match expected (%lld)" ,
1106
+ (long long ) len , (long long ) th -> fileLen );
1114
1107
1115
1108
pad = tarPaddingBytesRequired (len );
1116
1109
for (i = 0 ; i < pad ; i ++ )
@@ -1140,24 +1133,14 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
1140
1133
/* Go to end of current file, if any */
1141
1134
if (ctx -> tarFHpos != 0 )
1142
1135
{
1143
- char buf1 [100 ],
1144
- buf2 [100 ];
1145
-
1146
- snprintf (buf1 , sizeof (buf1 ), INT64_FORMAT , (int64 ) ctx -> tarFHpos );
1147
- snprintf (buf2 , sizeof (buf2 ), INT64_FORMAT , (int64 ) ctx -> tarNextMember );
1148
- pg_log_debug ("moving from position %s to next member at file position %s" ,
1149
- buf1 , buf2 );
1136
+ pg_log_debug ("moving from position %lld to next member at file position %lld" ,
1137
+ (long long ) ctx -> tarFHpos , (long long ) ctx -> tarNextMember );
1150
1138
1151
1139
while (ctx -> tarFHpos < ctx -> tarNextMember )
1152
1140
_tarReadRaw (AH , & c , 1 , NULL , ctx -> tarFH );
1153
1141
}
1154
1142
1155
- {
1156
- char buf [100 ];
1157
-
1158
- snprintf (buf , sizeof (buf ), INT64_FORMAT , (int64 ) ctx -> tarFHpos );
1159
- pg_log_debug ("now at file position %s" , buf );
1160
- }
1143
+ pg_log_debug ("now at file position %lld" , (long long ) ctx -> tarFHpos );
1161
1144
1162
1145
/* We are at the start of the file, or at the next member */
1163
1146
@@ -1265,25 +1248,12 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
1265
1248
1266
1249
len = read_tar_number (& h [124 ], 12 );
1267
1250
1268
- {
1269
- char posbuf [32 ];
1270
- char lenbuf [32 ];
1271
-
1272
- snprintf (posbuf , sizeof (posbuf ), UINT64_FORMAT , (uint64 ) hPos );
1273
- snprintf (lenbuf , sizeof (lenbuf ), UINT64_FORMAT , (uint64 ) len );
1274
- pg_log_debug ("TOC Entry %s at %s (length %s, checksum %d)" ,
1275
- tag , posbuf , lenbuf , sum );
1276
- }
1251
+ pg_log_debug ("TOC Entry %s at %llu (length %llu, checksum %d)" ,
1252
+ tag , (unsigned long long ) hPos , (unsigned long long ) len , sum );
1277
1253
1278
1254
if (chk != sum )
1279
- {
1280
- char posbuf [32 ];
1281
-
1282
- snprintf (posbuf , sizeof (posbuf ), UINT64_FORMAT ,
1283
- (uint64 ) ftello (ctx -> tarFH ));
1284
- fatal ("corrupt tar header found in %s (expected %d, computed %d) file position %s" ,
1285
- tag , sum , chk , posbuf );
1286
- }
1255
+ fatal ("corrupt tar header found in %s (expected %d, computed %d) file position %llu" ,
1256
+ tag , sum , chk , (unsigned long long ) ftello (ctx -> tarFH ));
1287
1257
1288
1258
th -> targetFile = pg_strdup (tag );
1289
1259
th -> fileLen = len ;
0 commit comments