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

Issue 1869: POSIX/Linux related changes to file_util.... (Closed)

Created:
12 years, 3 months ago by reima
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

POSIX/Linux related changes to file_util. 1. Replaced mktemp by mkstemp as mktemp should never be used (see http://linux.die.net/man/3/mktemp for instance). 2. Implemented file_util::CopyFile for the Linux platform. This also made the FileUtilTest pass, so I updated the scons file as well. 3. Cleaned up some invalid uses of c_str() on a temporary std::string. 4. Changed file_util::WriteFile to allow for partial writes.

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -20 lines) Patch
M base/SConscript View 1 2 2 chunks +1 line, -1 line 0 comments Download
M base/file_util_linux.cc View 1 2 2 chunks +46 lines, -3 lines 3 comments Download
M base/file_util_posix.cc View 1 2 3 6 chunks +31 lines, -16 lines 1 comment Download

Messages

Total messages: 20 (0 generated)
reima
12 years, 3 months ago (2008-09-09 22:50:51 UTC) #1
Erik does not do reviews
A few minor nits. Otherwise, Looks Good To Me. http://codereview.chromium.org/1869/diff/1/4 File base/file_util_linux.cc (right): http://codereview.chromium.org/1869/diff/1/4#newcode29 Line ...
12 years, 3 months ago (2008-09-09 23:55:55 UTC) #2
Mark Mentovai
Question. http://codereview.chromium.org/1869/diff/1/3 File base/file_util_posix.cc (right): http://codereview.chromium.org/1869/diff/1/3#newcode149 Line 149: int fd = mkstemp(buffer); This function's name ...
12 years, 3 months ago (2008-09-10 00:03:50 UTC) #3
Erik does not do reviews
http://codereview.chromium.org/1869/diff/1/3 File base/file_util_posix.cc (right): http://codereview.chromium.org/1869/diff/1/3#newcode146 Line 146: tmpdir.append(L"/com.google.chrome.XXXXXX"); I didn't notice this the first time. ...
12 years, 3 months ago (2008-09-10 00:11:57 UTC) #4
reima
http://codereview.chromium.org/1869/diff/1/3 File base/file_util_posix.cc (right): http://codereview.chromium.org/1869/diff/1/3#newcode146 Line 146: tmpdir.append(L"/com.google.chrome.XXXXXX"); I just found out there's AppendToPath. I'll ...
12 years, 3 months ago (2008-09-10 08:46:18 UTC) #5
reima
Thank you for your comments so far. I just attached a revised patch set.
12 years, 3 months ago (2008-09-10 20:27:34 UTC) #6
Mark Mentovai
http://codereview.chromium.org/1869/diff/8/210 File base/file_util_linux.cc (right): http://codereview.chromium.org/1869/diff/8/210#newcode36 Line 36: O_WRONLY | O_CREAT | O_EXCL, This should not ...
12 years, 3 months ago (2008-09-10 21:20:24 UTC) #7
Mark Mentovai
http://codereview.chromium.org/1869/diff/8/210 File base/file_util_linux.cc (right): http://codereview.chromium.org/1869/diff/8/210#newcode36 Line 36: O_WRONLY | O_CREAT | O_EXCL, P.S. When you ...
12 years, 3 months ago (2008-09-10 21:25:04 UTC) #8
Erik does not do reviews
http://codereview.chromium.org/1869/diff/1/3 File base/file_util_posix.cc (right): http://codereview.chromium.org/1869/diff/1/3#newcode146 Line 146: tmpdir.append(L"/com.google.chrome.XXXXXX"); On 2008/09/10 08:46:18, reima wrote: > I ...
12 years, 3 months ago (2008-09-10 21:52:24 UTC) #9
reima
http://codereview.chromium.org/1869/diff/8/210 File base/file_util_linux.cc (right): http://codereview.chromium.org/1869/diff/8/210#newcode36 Line 36: O_WRONLY | O_CREAT | O_EXCL, On 2008/09/10 21:25:04, ...
12 years, 3 months ago (2008-09-10 22:39:47 UTC) #10
reima
http://codereview.chromium.org/1869/diff/8/209 File base/file_util_posix.cc (right): http://codereview.chromium.org/1869/diff/8/209#newcode149 Line 149: int fd = mkstemp(buffer); On 2008/09/10 22:39:48, reima ...
12 years, 3 months ago (2008-09-10 22:45:49 UTC) #11
Erik does not do reviews
http://codereview.chromium.org/1869/diff/8/210 File base/file_util_linux.cc (right): http://codereview.chromium.org/1869/diff/8/210#newcode44 Line 44: scoped_array<char> buffer(new char[kBufferSize]); On 2008/09/10 22:39:48, reima wrote: ...
12 years, 3 months ago (2008-09-10 22:55:14 UTC) #12
reima
http://codereview.chromium.org/1869/diff/8/209 File base/file_util_posix.cc (right): http://codereview.chromium.org/1869/diff/8/209#newcode48 Line 48: const char* utf8_path = WideToUTF8(path).c_str(); Possibly invalid use ...
12 years, 3 months ago (2008-09-11 01:04:36 UTC) #13
reima
Next round (updated patch set). Tell me what you think now.
12 years, 3 months ago (2008-09-11 14:30:15 UTC) #14
Mark Mentovai
http://codereview.chromium.org/1869/diff/402/17 File base/file_util_posix.cc (right): http://codereview.chromium.org/1869/diff/402/17#newcode23 Line 23: const wchar_t* kTempFileName = L"com.google.chrome.XXXXXX"; Can you make ...
12 years, 3 months ago (2008-09-11 14:35:20 UTC) #15
reima
Thanks again for your comments, revised patch set is already up. http://codereview.chromium.org/1869/diff/402/17 File base/file_util_posix.cc (right): ...
12 years, 3 months ago (2008-09-11 15:39:35 UTC) #16
Erik does not do reviews
LGTM Thanks for doing the c_str() cleanup along with this checkin!
12 years, 3 months ago (2008-09-11 17:19:27 UTC) #17
Mark Mentovai
Committed r2070, feel free to close this out now. Thanks for the patch, for sticking ...
12 years, 3 months ago (2008-09-11 17:37:13 UTC) #18
Dean McNamee
Realize this is already checked in, I'm slow, apparently. http://codereview.chromium.org/1869/diff/407/25 File base/file_util_linux.cc (right): http://codereview.chromium.org/1869/diff/407/25#newcode33 Line ...
12 years, 3 months ago (2008-09-12 13:59:46 UTC) #19
Erik does not do reviews
12 years, 3 months ago (2008-09-12 16:00:50 UTC) #20
http://codereview.chromium.org/1869/diff/407/25
File base/file_util_linux.cc (right):

http://codereview.chromium.org/1869/diff/407/25#newcode33
Line 33: int outfile = creat(WideToUTF8(to_path).c_str(), 0666);
On 2008/09/12 13:59:46, deanm wrote:
> Is this the right thing to do?  I would think we should either take the mode
> from the file we're copying, or to use the umask, not to hardcode 0666.

My understanding is that both creat() and open() use the umask for you.  That's
why we're passing in 0666, so that we give full control to the user's umask.

Powered by Google App Engine
This is Rietveld 408576698