Skip to content
Permalink
Browse files

Fix erroneous parameter name.

The exists() function only checks for files so the parameter name should reflect that.
  • Loading branch information...
dwsteele committed Jun 4, 2019
1 parent 0945d96 commit 5f92c36b30072edb71b12f79163c37c67d9806bc
Showing with 14 additions and 14 deletions.
  1. +5 −5 src/storage/posix/storage.c
  2. +4 −4 src/storage/remote/storage.c
  3. +4 −4 src/storage/s3/storage.c
  4. +1 −1 src/storage/storage.intern.h
@@ -47,28 +47,28 @@ struct StoragePosix
Does a file exist? This function is only for files, not paths.
***********************************************************************************************************************************/
static bool
storagePosixExists(THIS_VOID, const String *path)
storagePosixExists(THIS_VOID, const String *file)
{
THIS(StoragePosix);

FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
FUNCTION_LOG_PARAM(STRING, path);
FUNCTION_LOG_PARAM(STRING, file);
FUNCTION_LOG_END();

ASSERT(this != NULL);
ASSERT(path != NULL);
ASSERT(file != NULL);

bool result = false;

// Attempt to stat the file to determine if it exists
struct stat statFile;

// Any error other than entry not found should be reported
if (stat(strPtr(path), &statFile) == -1)
if (stat(strPtr(file), &statFile) == -1)
{
if (errno != ENOENT)
THROW_SYS_ERROR_FMT(FileOpenError, "unable to stat '%s'", strPtr(path));
THROW_SYS_ERROR_FMT(FileOpenError, "unable to stat '%s'", strPtr(file));
}
// Else found
else
@@ -30,24 +30,24 @@ struct StorageRemote
Does a file exist? This function is only for files, not paths.
***********************************************************************************************************************************/
static bool
storageRemoteExists(THIS_VOID, const String *path)
storageRemoteExists(THIS_VOID, const String *file)
{
THIS(StorageRemote);

FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
FUNCTION_LOG_PARAM(STRING, path);
FUNCTION_LOG_PARAM(STRING, file);
FUNCTION_LOG_END();

ASSERT(this != NULL);
ASSERT(path != NULL);
ASSERT(file != NULL);

bool result = false;

MEM_CONTEXT_TEMP_BEGIN()
{
ProtocolCommand *command = protocolCommandNew(PROTOCOL_COMMAND_STORAGE_EXISTS_STR);
protocolCommandParamAdd(command, VARSTR(path));
protocolCommandParamAdd(command, VARSTR(file));

result = varBool(protocolClientExecute(this->client, command, true));
}
@@ -342,17 +342,17 @@ storageS3Request(
Does a file exist? This function is only for files, not paths.
***********************************************************************************************************************************/
static bool
storageS3Exists(THIS_VOID, const String *path)
storageS3Exists(THIS_VOID, const String *file)
{
THIS(StorageS3);

FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STORAGE_S3, this);
FUNCTION_LOG_PARAM(STRING, path);
FUNCTION_LOG_PARAM(STRING, file);
FUNCTION_LOG_END();

ASSERT(this != NULL);
ASSERT(path != NULL);
ASSERT(file != NULL);

bool result = false;

@@ -361,7 +361,7 @@ storageS3Exists(THIS_VOID, const String *path)
HttpQuery *query = httpQueryNew();

// Generate the file name as a prefix. Muliple files may be returned but this will narrow down the list.
String *prefix = strNewFmt("%s", strPtr(strSub(path, 1)));
String *prefix = strNewFmt("%s", strPtr(strSub(file, 1)));
httpQueryAdd(query, S3_QUERY_PREFIX_STR, prefix);

// Build the query using list type 2
@@ -57,7 +57,7 @@ typedef struct StorageInterface
// Features implemented by the storage driver
uint64_t feature;

bool (*exists)(void *driver, const String *path);
bool (*exists)(void *driver, const String *file);
StorageInfo (*info)(void *driver, const String *path, bool followLink);
bool (*infoList)(void *driver, const String *file, StorageInfoListCallback callback, void *callbackData);
StringList *(*list)(void *driver, const String *path, const String *expression);

0 comments on commit 5f92c36

Please sign in to comment.
You can’t perform that action at this time.