#1839 closed defect (fixed)

multiple system calls return incorrect status or incorrectly check permission

Reported by: Xiang Cui Owned by: Chris Johns
Priority: normal Milestone: 4.11
Component: fs Version: 4.11
Severity: minor Keywords:
Cc: joel.sherrill@… Blocked By:
Blocking:

Description

In testsuites/psxtests/psxfile01/test.c, line 390

/*

  • Read from filedes opened for write */

puts( "open /tmp/bha in write only mode -- OK" );
fd = open( "/tmp/bha", O_CREAT | O_WRONLY, S_IRWXU|S_IRWXG|S_IRWXO );
rtems_test_assert( fd != -1 );

puts( "attempt fcntl on opened file -- OK" );
status = fcntl( fd, F_SETFD, 0 );
rtems_test_assert( status == 0 );

puts( "attempt to read from /tmp/bha - expect EINVAL" );
status = read( fd, buffer, 10 );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EINVAL );

According to http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html
in this case, read should fall with EBADF.

Attachments (5)

pr1839.diff (3.9 KB) - added by Joel Sherrill on Jul 18, 2011 at 6:41:42 PM.
Patch for Review
pr1839_v1.diff (10.2 KB) - added by Joel Sherrill on Jul 19, 2011 at 12:42:00 PM.
Second version .. but without test updates
pr1839_v2.diff (13.3 KB) - added by Joel Sherrill on Jul 19, 2011 at 3:22:49 PM.
Patch with test code updated
pr1838_410.diff (566 bytes) - added by Joel Sherrill on Jul 22, 2011 at 3:13:11 PM.
Patch to system calls for 4.10
pr1839_49.diff (8.7 KB) - added by Joel Sherrill on Jul 22, 2011 at 3:13:35 PM.
Patch to system calls for 4.9

Download all attachments as: .zip

Change History (11)

Changed on Jul 18, 2011 at 6:41:42 PM by Joel Sherrill

Attachment: pr1839.diff added

Patch for Review

comment:1 Changed on Jul 19, 2011 at 12:39:05 PM by Joel Sherrill

Cc: Joel Sherrill added

Changed on Jul 19, 2011 at 12:42:00 PM by Joel Sherrill

Attachment: pr1839_v1.diff added

Second version .. but without test updates

comment:2 Changed on Jul 19, 2011 at 12:42:00 PM by Joel Sherrill

attachments.isobsolete: 01

comment:3 Changed on Jul 19, 2011 at 12:42:34 PM by Joel Sherrill

Summary: call read with a write only file descriptor should fall with EBADFmultiple system calls return incorrect status or incorrectly check permission

Changed on Jul 19, 2011 at 3:22:49 PM by Joel Sherrill

Attachment: pr1839_v2.diff added

Patch with test code updated

comment:4 Changed on Jul 19, 2011 at 3:22:49 PM by Joel Sherrill

attachments.isobsolete: 01

Changed on Jul 22, 2011 at 3:13:11 PM by Joel Sherrill

Attachment: pr1838_410.diff added

Patch to system calls for 4.10

Changed on Jul 22, 2011 at 3:13:35 PM by Joel Sherrill

Attachment: pr1839_49.diff added

Patch to system calls for 4.9

comment:5 Changed on Jul 22, 2011 at 3:13:49 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

Patches committed. Closing.

comment:6 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

Note: See TracTickets for help on using tickets.