lirios / terminal

:rocket: Terminal
GNU General Public License v3.0
29 stars 3 forks source link

error: ignoring return value of function declared with #5

Closed fedya closed 6 years ago

fedya commented 7 years ago

[ 29%] Building CXX object lib/CMakeFiles/qmltermwidget.dir/BlockArray.cpp.o /home/omv/liri-terminal/BUILD/liri-terminal-0.1-20170221/lib/BlockArray.cpp:234:9: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] ftruncate(ion, length*blocksize); ^~~ ~~~~~~~ 1 error generated.

patch

diff --git a/lib/BlockArray.cpp b/lib/BlockArray.cpp
index 3f36390..240852f 100644
--- a/lib/BlockArray.cpp
+++ b/lib/BlockArray.cpp
@@ -231,7 +231,8 @@ bool BlockArray::setHistorySize(size_t newsize)
         return false;
     } else {
         decreaseBuffer(newsize);
-        ftruncate(ion, length*blocksize);
+        if (ftruncate(ion, length*blocksize) == -1)
+                 perror("ftruncate");
         size = newsize;

         return true;
fedya commented 7 years ago
In file included from /home/omv/liri-terminal/BUILD/liri-terminal-0.1-20170221/lib/kpty.cpp:25:
In file included from /home/omv/liri-terminal/BUILD/liri-terminal-0.1-20170221/lib/kpty_p.h:26:
/home/omv/liri-terminal/BUILD/liri-terminal-0.1-20170221/lib/kpty.h:36:5: error: class 'KPtyPrivate' was previously declared as a struct [-Werror,-Wmismatched-tags]
    Q_DECLARE_PRIVATE(KPty)
    ^
/usr/include/qt5/QtCore/qglobal.h:966:12: note: expanded from macro 'Q_DECLARE_PRIVATE'
    friend class Class##Private;
           ^
/home/omv/liri-terminal/BUILD/liri-terminal-0.1-20170221/lib/kpty.h:28:8: note: previous use is here
struct KPtyPrivate;
       ^
/home/omv/liri-terminal/BUILD/liri-terminal-0.1-20170221/lib/kpty.cpp:455:17: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]
                chown(d->ttyName.data(), 0, st.st_gid == getgid() ? 0 : -1);
                ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.