summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-12-28 16:36:08 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-12-28 16:36:08 +0000
commit44be50c22f5bb8d9a3c00bd0ff6bcdf97e0da22f (patch)
tree7727045fe5bc27127acf9b28ae8a10a7565a800b
parent2009-12-23 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-44be50c22f5bb8d9a3c00bd0ff6bcdf97e0da22f.tar.bz2
2009-12-28 Shrikant Gaikwad <n3oo3n@gmail.com>
* cpukit/libfs/src/pipe/pipe.c Restructured code to remove the goto statements.
-rw-r--r--cpukit/ChangeLog5
-rw-r--r--cpukit/libcsupport/include/rtems/framebuffer.h2
-rw-r--r--cpukit/libfs/src/pipe/pipe.c28
3 files changed, 19 insertions, 16 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 899d253225..ee0f3497d9 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -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.
diff --git a/cpukit/libcsupport/include/rtems/framebuffer.h b/cpukit/libcsupport/include/rtems/framebuffer.h
index a4124d4ca2..a300716c58 100644
--- a/cpukit/libcsupport/include/rtems/framebuffer.h
+++ b/cpukit/libcsupport/include/rtems/framebuffer.h
@@ -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 }
diff --git a/cpukit/libfs/src/pipe/pipe.c b/cpukit/libfs/src/pipe/pipe.c
index 54628898ac..cf38c45e95 100644
--- a/cpukit/libfs/src/pipe/pipe.c
+++ b/cpukit/libfs/src/pipe/pipe.c
@@ -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]);
- }
-
-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);
}
+