From af23324f8c0535507dad49b3afc8b91b076ea4e7 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Wed, 22 Apr 2009 06:59:26 +0000 Subject: [PATCH] posix_fadvise() does not return error code in errno --- src/utilities/nbackup.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utilities/nbackup.cpp b/src/utilities/nbackup.cpp index 65259245c1..7080e1978a 100644 --- a/src/utilities/nbackup.cpp +++ b/src/utilities/nbackup.cpp @@ -373,10 +373,12 @@ void NBackup::open_database_scan() if (dbase < 0) b_error::raise(uSvc, "Error (%d) opening database file: %s", errno, dbname.c_str()); #ifdef HAVE_POSIX_FADVISE - if (posix_fadvise(dbase, 0, 0, POSIX_FADV_SEQUENTIAL) < 0) - b_error::raise(uSvc, "Error (%d) in posix_fadvise(SEQUENTIAL) for %s", errno, dbname.c_str()); - if (posix_fadvise(dbase, 0, 0, POSIX_FADV_NOREUSE) < 0) - b_error::raise(uSvc, "Error (%d) in posix_fadvise(NOREUSE) for %s", errno, dbname.c_str()); + int rc = posix_fadvise(dbase, 0, 0, POSIX_FADV_SEQUENTIAL); + if (rc) + b_error::raise(uSvc, "Error (%d) in posix_fadvise(SEQUENTIAL) for %s", rc, dbname.c_str()); + rc = posix_fadvise(dbase, 0, 0, POSIX_FADV_NOREUSE); + if (rc) + b_error::raise(uSvc, "Error (%d) in posix_fadvise(NOREUSE) for %s", rc, dbname.c_str()); #endif // HAVE_POSIX_FADVISE #endif // WIN_NT }