You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/10/01 18:15:47 UTC
svn commit: r820702 - in /commons/sandbox/runtime/trunk/src/main/native/os:
unix/fsysio.c unix/temps.c win32/fsysio.c win32/temps.c
Author: mturk
Date: Thu Oct 1 16:15:46 2009
New Revision: 820702
URL: http://svn.apache.org/viewvc?rev=820702&view=rev
Log:
Set needed file members for temp files
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c?rev=820702&r1=820701&r2=820702&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c Thu Oct 1 16:15:46 2009
@@ -189,10 +189,14 @@
fp->name = ACR_StrdupA(_E, THROW_NMARK, fname);
fp->flags = flags;
fp->type = ACR_FT_REG; /* Presume it's a regular file */
- if (flags & ACR_FOPEN_NONBLOCK)
+ if (flags & ACR_FOPEN_NONBLOCK) {
fp->blocking = BLK_OFF;
- else
+ fp->timeout = 0;
+ }
+ else {
fp->blocking = BLK_ON;
+ fp->timeout = -1;
+ }
if (flags & ACR_FOPEN_NOCLEANUP)
fo = acr_ioh_open(fp, ACR_DT_FILE, 0, NULL);
else
@@ -279,7 +283,7 @@
static int wait_for_io(acr_file_t *f, int for_read)
{
- int rc, timeout = f->timeout > 0 ? (int)(f->timeout / 1000) : -1;;
+ int rc, timeout = f->timeout > 0 ? (int)(f->timeout / 1000) : -1;
f->ppoll.fd = f->fd;
f->ppoll.events = for_read ? POLLIN : POLLOUT;
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c?rev=820702&r1=820701&r2=820702&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c Thu Oct 1 16:15:46 2009
@@ -56,7 +56,11 @@
rc = ACR_SUCCESS;
}
x_free(fp->name);
- x_free(fp);
+ fp->name = NULL;
+ if (flags & ACR_IOH_CLEAR)
+ x_free(fp);
+ else
+ fp->fd = -1;
return rc;
}
@@ -118,8 +122,12 @@
if (!fp) {
goto cleanup;
}
- fp->fd = fd;
- fp->name = ACR_StrdupA(_E, THROW_NMARK, name);
+ fp->fd = fd;
+ fp->type = ACR_FT_REG;
+ fp->name = ACR_StrdupA(_E, THROW_NMARK, name);
+ fp->blocking = BLK_ON;
+ fp->timeout = -1;
+ fp->flags = ACR_FOPEN_READ | ACR_FOPEN_WRITE | ACR_FOPEN_CREATE;
rc = acr_ioh_open(fp, ACR_DT_FILE, 0, tmp_file_cleanup);
return rc;
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c?rev=820702&r1=820701&r2=820702&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c Thu Oct 1 16:15:46 2009
@@ -181,10 +181,14 @@
fp->fd = fh;
fp->flags = flags;
fp->type = ACR_FT_REG; /* Presume it's a regular file */
- if (flags & ACR_FOPEN_NONBLOCK)
+ if (flags & ACR_FOPEN_NONBLOCK) {
fp->blocking = BLK_OFF;
- else
+ fp->timeout = 0;
+ }
+ else {
fp->blocking = BLK_ON;
+ fp->timeout = -1;
+ }
if (flags & ACR_FOPEN_NOCLEANUP)
fo = acr_ioh_open(fp, ACR_DT_FILE, 0, NULL);
else
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c?rev=820702&r1=820701&r2=820702&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c Thu Oct 1 16:15:46 2009
@@ -59,8 +59,11 @@
else
rc = ACR_SUCCESS;
}
- x_free(fp->name);
- x_free(fp);
+ fp->name = NULL;
+ if (flags & ACR_IOH_CLEAR)
+ x_free(fp);
+ else
+ fp->fd = INVALID_HANDLE_VALUE;
return rc;
}
@@ -301,8 +304,12 @@
if (!fp) {
goto cleanup;
}
- fp->fd = fd;
- fp->name = ACR_StrdupW(_E, THROW_NMARK, name);
+ fp->fd = fd;
+ fp->type = ACR_FT_REG;
+ fp->name = ACR_StrdupW(_E, THROW_NMARK, name);
+ fp->blocking = BLK_ON;
+ fp->timeout = -1;
+ fp->flags = ACR_FOPEN_READ | ACR_FOPEN_WRITE | ACR_FOPEN_CREATE;
rc = acr_ioh_open(fp, ACR_DT_FILE, 0, tmp_file_cleanup);
return rc;