Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Unified Diff: runtime/bin/directory_posix.cc

Issue 9630012: Error reporting on File in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Style issues Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/directory_impl.dart ('k') | runtime/bin/directory_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_posix.cc
diff --git a/runtime/bin/directory_posix.cc b/runtime/bin/directory_posix.cc
index 527509be343eed25535bda624f464ce64d6b7859..042994340ca688ff26189f3dde4eacd2acf7389a 100644
--- a/runtime/bin/directory_posix.cc
+++ b/runtime/bin/directory_posix.cc
@@ -21,12 +21,6 @@ static char* SafeStrNCpy(char* dest, const char* src, size_t n) {
}
-static void SetOsErrorMessage(char* os_error_message,
- int os_error_message_len) {
- SafeStrNCpy(os_error_message, strerror(errno), os_error_message_len);
-}
-
-
// Forward declarations.
static bool ListRecursively(const char* dir_name,
bool recursive,
@@ -389,37 +383,32 @@ bool Directory::Create(const char* dir_name) {
}
-int Directory::CreateTemp(const char* const_template,
- char** path,
- char* os_error_message,
- int os_error_message_len) {
+char* Directory::CreateTemp(const char* const_template) {
// Returns a new, unused directory name, modifying the contents of
// dir_template. Creates the directory with the permissions specified
// by the process umask.
// The return value must be freed by the caller.
- *path = static_cast<char*>(malloc(PATH_MAX + 1));
- SafeStrNCpy(*path, const_template, PATH_MAX + 1);
- int path_length = strlen(*path);
+ char* path = static_cast<char*>(malloc(PATH_MAX + 1));
+ SafeStrNCpy(path, const_template, PATH_MAX + 1);
+ int path_length = strlen(path);
if (path_length > 0) {
- if ((*path)[path_length - 1] == '/') {
- snprintf(*path + path_length, PATH_MAX - path_length, "temp_dir_XXXXXX");
+ if ((path)[path_length - 1] == '/') {
+ snprintf(path + path_length, PATH_MAX - path_length, "temp_dir_XXXXXX");
} else {
- snprintf(*path + path_length, PATH_MAX - path_length, "XXXXXX");
+ snprintf(path + path_length, PATH_MAX - path_length, "XXXXXX");
}
} else {
- snprintf(*path, PATH_MAX, "/tmp/temp_dir1_XXXXXX");
+ snprintf(path, PATH_MAX, "/tmp/temp_dir1_XXXXXX");
}
char* result;
do {
- result = mkdtemp(*path);
+ result = mkdtemp(path);
} while (result == NULL && errno == EINTR);
if (result == NULL) {
- SetOsErrorMessage(os_error_message, os_error_message_len);
- free(*path);
- *path = NULL;
- return errno;
+ free(path);
+ return NULL;
}
- return 0;
+ return path;
}
« no previous file with comments | « runtime/bin/directory_impl.dart ('k') | runtime/bin/directory_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698