octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65504] fcntl is unable to perform read operat


From: Rik
Subject: [Octave-bug-tracker] [bug #65504] fcntl is unable to perform read operations
Date: Thu, 21 Mar 2024 20:36:53 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?65504>

                 Summary: fcntl is unable to perform read operations
                   Group: GNU Octave
               Submitter: rik5
               Submitted: Thu 21 Mar 2024 05:36:52 PM PDT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: 10.1.0 (current default)


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 21 Mar 2024 05:36:52 PM PDT By: Rik <rik5>
The prototype for fcntl() is


int fcntl(int fd, int cmd, ... /* arg */ )


When the command operation is a write operation such as F_SETFL (SET FLags)
then the third argument is the desired value for the flags.

But there are also read commands such as F_GETFL (GET FLags).  The flags would
be returned in the int value that is the output of fcntl.  Unfortunately,
Octave treats the output as status, and anything >= 0 is seen as good and
reported as 0 status.


  octave_value_list retval;
  std::string msg;

  int status = sys::fcntl (fid, req, arg, msg);

  if (nargout == 0)
    {
      if (status < 0)
        error ("fcntl: operation failed: %s", msg.c_str ());
    }
  else
    {
      if (status < 0)
        retval = ovl (-1.0, msg);
      else
        retval = ovl (0.0, "");
    }










    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65504>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]