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

Side by Side Diff: base/file_util_posix.cc

Issue 194036: Removes a piece of comment that no longer applies. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <fnmatch.h> 10 #include <fnmatch.h>
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 ssize_t bytes_read = 367 ssize_t bytes_read =
368 HANDLE_EINTR(read(fd, buffer + total_read, bytes - total_read)); 368 HANDLE_EINTR(read(fd, buffer + total_read, bytes - total_read));
369 if (bytes_read <= 0) 369 if (bytes_read <= 0)
370 break; 370 break;
371 total_read += bytes_read; 371 total_read += bytes_read;
372 } 372 }
373 return total_read == bytes; 373 return total_read == bytes;
374 } 374 }
375 375
376 // Creates and opens a temporary file in |directory|, returning the 376 // Creates and opens a temporary file in |directory|, returning the
377 // file descriptor. |path| is set to the temporary file path. 377 // file descriptor. |path| is set to the temporary file path.
378 // Note TODO(erikkay) comment in header for BlahFileName() calls; the 378 // This function does NOT unlink() the file.
379 // intent is to rename these files BlahFile() (since they create
380 // files, not filenames). This function does NOT unlink() the file.
381 int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) { 379 int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) {
382 *path = directory.Append(kTempFileName); 380 *path = directory.Append(kTempFileName);
383 const std::string& tmpdir_string = path->value(); 381 const std::string& tmpdir_string = path->value();
384 // this should be OK since mkstemp just replaces characters in place 382 // this should be OK since mkstemp just replaces characters in place
385 char* buffer = const_cast<char*>(tmpdir_string.c_str()); 383 char* buffer = const_cast<char*>(tmpdir_string.c_str());
386 384
387 return mkstemp(buffer); 385 return mkstemp(buffer);
388 } 386 }
389 387
390 bool CreateTemporaryFile(FilePath* path) { 388 bool CreateTemporaryFile(FilePath* path) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 munmap(data_, length_); 722 munmap(data_, length_);
725 if (file_ != -1) 723 if (file_ != -1)
726 close(file_); 724 close(file_);
727 725
728 data_ = NULL; 726 data_ = NULL;
729 length_ = 0; 727 length_ = 0;
730 file_ = -1; 728 file_ = -1;
731 } 729 }
732 730
733 } // namespace file_util 731 } // namespace file_util
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698