Project

General

Profile

Actions

Bug #11232

open

Fix pfSense_fsync

Added by Martin VENÇON almost 4 years ago. Updated almost 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Operating System
Target version:
-
Start date:
01/07/2021
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
Affected Architecture:

Description

Hello,

pfSense_fsync has not been working for a while as this commit: https://github.com/pfsense/pfsense/commit/c5663bf5c9a830d5c265bd26e875ce271081eb3f is still in use.
All the calls to this function are commented in the pfSense code.

Here is a fix that makes the function work again:

diff --git a/devel/php-pfSense-module/files/pfSense.c b/devel/php-pfSense-module/files/pfSense.c
--- a/devel/php-pfSense-module/files/pfSense.c
+++ b/devel/php-pfSense-module/files/pfSense.c
@@ -4009,7 +4009,7 @@ PHP_FUNCTION(pfSense_fsync) {
        if ((fname = strdup(fname)) == NULL)
                RETURN_FALSE;
        parent_dir = dirname(fname);
-       fd = open(parent_dir, O_RDWR|O_CLOEXEC);
+       fd = open(parent_dir, O_RDONLY|O_CLOEXEC);
        free(fname);
        if (fd == -1)
                RETURN_FALSE;

A directory cannot be opened with write access, as mentionned in https://www.freebsd.org/cgi/man.cgi?query=open&sektion=2.

[EISDIR]        The named file is a directory, and the arguments spec-
            ify it is to be    modified.

Actions

Also available in: Atom PDF