Просмотр исходного кода

libdpkg: Remove unneeded checks on buffer_copy loop termination

The while loop checks unnecessarily for bytesread and byteswritten
being >= 0, but that's always going to be true, as in case of read or
write error the code breaks out of the loop.
Guillem Jover лет назад: 15
Родитель
Сommit
751c399e50
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      lib/dpkg/buffer.c

+ 1 - 1
lib/dpkg/buffer.c

@@ -166,7 +166,7 @@ buffer_copy(struct buffer_data *read_data, struct buffer_data *write_data,
 
 	buffer_init(write_data);
 
-	while (bytesread >= 0 && byteswritten >= 0 && bufsize > 0) {
+	while (bufsize > 0) {
 		bytesread = buffer_read(read_data, buf, bufsize);
 		if (bytesread < 0)
 			break;