You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2011/05/16 16:14:19 UTC
svn commit: r1103744 -
/incubator/celix/trunk/framework/private/src/bundle_archive.c
Author: abroekhuis
Date: Mon May 16 14:14:19 2011
New Revision: 1103744
URL: http://svn.apache.org/viewvc?rev=1103744&view=rev
Log:
Updated file creation using apr
Modified:
incubator/celix/trunk/framework/private/src/bundle_archive.c
Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1103744&r1=1103743&r2=1103744&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Mon May 16 14:14:19 2011
@@ -236,7 +236,7 @@ void bundleArchive_setPersistentState(BU
strcpy(persistentStateLocation, archive->archiveRoot);
strcat(persistentStateLocation, "/bundle.state");
apr_file_t *persistentStateLocationFile;
- apr_file_open(&persistentStateLocationFile, persistentStateLocation, APR_FOPEN_WRITE, APR_OS_DEFAULT, archive->mp);
+ apr_file_open(&persistentStateLocationFile, persistentStateLocation, APR_FOPEN_CREATE|APR_FOPEN_WRITE, APR_OS_DEFAULT, archive->mp);
char * s;
switch (state) {
case BUNDLE_ACTIVE:
@@ -267,15 +267,14 @@ long bundleArchive_getRefreshCount(BUNDL
strcpy(refreshCounter,archive->archiveRoot);
strcat(refreshCounter, "/refresh.counter");
apr_file_t * refreshCounterFile;
- apr_file_open(&refreshCounterFile, refreshCounter, APR_FOPEN_READ, APR_OS_DEFAULT, archive->mp);
-
- if (refreshCounterFile != NULL) {
+ apr_status_t rv;
+ if ((rv = apr_file_open(&refreshCounterFile, refreshCounter, APR_FOPEN_READ, APR_OS_DEFAULT, archive->mp)) != APR_SUCCESS) {
+ archive->refreshCount = 0;
+ } else {
char counterStr[256];
apr_file_gets(counterStr , sizeof(counterStr) , refreshCounterFile);
apr_file_close(refreshCounterFile);
sscanf(counterStr, "%ld", &archive->refreshCount);
- } else {
- archive->refreshCount = 0;
}
return archive->refreshCount;
}