(trunk, libt) #4160 - the slow slog to catch trunk up to mike.dld's 4160 diff continues. This step applies 4160-04b-dir.patch, which replaces native file operations with the tr_sys_dir_*() portability wrappers added in the previous commit.

This commit is contained in:
Jordan Lee
2014-09-21 17:55:39 +00:00
parent 51a90d0da0
commit d9d66e3e42
15 changed files with 129 additions and 271 deletions

View File

@@ -9,24 +9,19 @@
#include <assert.h>
#include <ctype.h> /* isspace */
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcmp */
#ifdef _WIN32
#include <direct.h> /* getcwd */
#else
#include <unistd.h> /* getcwd */
#endif
#include <event2/buffer.h>
#define CURL_DISABLE_TYPECHECK /* otherwise -Wunreachable-code goes insane */
#include <curl/curl.h>
#include <libtransmission/transmission.h>
#include <libtransmission/error.h>
#include <libtransmission/file.h>
#include <libtransmission/log.h>
#include <libtransmission/rpcimpl.h>
#include <libtransmission/tr-getopt.h>
@@ -498,21 +493,18 @@ static char*
tr_getcwd (void)
{
char * result;
char buf[2048];
tr_error * error = NULL;
#ifdef _WIN32
result = _getcwd (buf, sizeof (buf));
#else
result = getcwd (buf, sizeof (buf));
#endif
result = tr_sys_dir_get_current (&error);
if (result == NULL)
{
fprintf (stderr, "getcwd error: \"%s\"", tr_strerror (errno));
*buf = '\0';
fprintf (stderr, "getcwd error: \"%s\"", error->message);
tr_error_free (error);
result = tr_strdup ("");
}
return tr_strdup (buf);
return result;
}
static char*