osaf/services/saf/logsv/lgs/lgs_filehdl.cc |  5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)


Not convert `offset` data to `off_t` when passing to `lseek`,
causing the `offset` value is an big big number.

This patch does convert `offset` value to `off_t` type.

diff --git a/osaf/services/saf/logsv/lgs/lgs_filehdl.cc 
b/osaf/services/saf/logsv/lgs/lgs_filehdl.cc
--- a/osaf/services/saf/logsv/lgs/lgs_filehdl.cc
+++ b/osaf/services/saf/logsv/lgs/lgs_filehdl.cc
@@ -263,7 +263,6 @@ int write_log_record_hdl(void *indata, v
                if (bytes_written < params_in->record_size)
                        goto retry;
        }
-
        osaf_mutex_lock_ordie(&lgs_ftcom_mutex); /* LOCK after critical section 
*/
 
        /* If the thread was hanging and has timed out and the log record was
@@ -271,8 +270,8 @@ int write_log_record_hdl(void *indata, v
         * returned SA_AIS_TRY_AGAIN).
         */
        if (*timeout_f == true) {
-               TRACE("Timeout, removing last log record");
-               file_length = lseek(params_in->fd, -bytes_written, SEEK_END);
+               LOG_NO("Timeout, removing last log record");
+               file_length = lseek(params_in->fd, -((off_t)bytes_written), 
SEEK_END);
                if (file_length != -1) {
                        do {
                                rc = ftruncate(params_in->fd, file_length);

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to