2009-12-28 Shrikant Gaikwad <n3oo3n@gmail.com>

* cpukit/libfs/src/pipe/pipe.c Restructured code to remove the
	goto statements.
This commit is contained in:
Joel Sherrill
2009-12-28 16:36:08 +00:00
parent e1ddc14b08
commit 44be50c22f
3 changed files with 19 additions and 16 deletions

View File

@@ -1,3 +1,8 @@
2009-12-28 Shrikant Gaikwad <n3oo3n@gmail.com>
* cpukit/libfs/src/pipe/pipe.c Restructured code to remove the
goto statements.
2009-12-21 Joel Sherrill <joel.sherrill@oarcorp.com>
* libnetworking/lib/ftpfs.c: Use EINVAL not EBADRQC.

View File

@@ -32,7 +32,7 @@ extern "C" {
* This macro defines the standard device driver table entry for
* a frame buffer device driver.
*/
#define FRAMEBUFFER_DRIVER_TABLE_ENTRY \
#define FRAME_BUFFER_DRIVER_TABLE_ENTRY \
{ frame_buffer_initialize, frame_buffer_open, frame_buffer_close, \
frame_buffer_read, frame_buffer_write, frame_buffer_control }

View File

@@ -28,7 +28,6 @@ int pipe_create(
rtems_filesystem_location_info_t loc;
rtems_libio_t *iop;
int err = 0;
/* Create /tmp if not exists */
if (rtems_filesystem_evaluate_path("/tmp", 3, RTEMS_LIBIO_PERMS_RWX, &loc, TRUE)
!= 0) {
@@ -47,8 +46,9 @@ int pipe_create(
/* Try creating FIFO file until find an available file name */
while (mkfifo(fifopath, S_IRUSR|S_IWUSR) != 0) {
if (errno != EEXIST)
if (errno != EEXIST){
return -1;
}
/* Just try once... */
return -1;
sprintf(fifopath + 10, "%04x", rtems_pipe_no ++);
@@ -58,26 +58,24 @@ int pipe_create(
filsdes[0] = open(fifopath, O_RDONLY | O_NONBLOCK);
if (filsdes[0] < 0) {
err = errno;
goto out;
/* Delete file at errors, or else if pipe is successfully created
the file node will be deleted after it is closed by all. */
unlink(fifopath);
}
else {
/* Reset open file to blocking mode */
iop = rtems_libio_iop(filsdes[0]);
iop->flags &= ~LIBIO_FLAGS_NO_DELAY;
iop = rtems_libio_iop(filsdes[0]);
iop->flags &= ~LIBIO_FLAGS_NO_DELAY;
filsdes[1] = open(fifopath, O_WRONLY);
filsdes[1] = open(fifopath, O_WRONLY);
if (filsdes[1] < 0) {
if (filsdes[1] < 0) {
err = errno;
close(filsdes[0]);
}
unlink(fifopath);
}
out:
/* Delete file at errors, or else if pipe is successfully created
the file node will be deleted after it is closed by all. */
unlink(fifopath);
if (! err)
return 0;
rtems_set_errno_and_return_minus_one(err);
}