/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
bool safeRead( int fd, void* buffer, std::size_t count )
{ auto nToRead = count; unsignedchar* bufferForReading = static_cast<unsignedchar *>(buffer);
while ( nToRead ) { auto nRead = read(fd, bufferForReading, cap_ssize_t(nToRead)); if ( nRead < 0 ) { // We were interrupted before reading, retry. if (errno == EINTR) continue;
returnfalse;
}
// If we reach the EOF, we consider this a partial transfer and thus // an error. if ( nRead == 0 ) returnfalse;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.