Commit graph

7 commits

Author SHA1 Message Date
Dan Albert
98ff77204c Create libbase.
Move StringPrintf and the string based file I/O from libutils to
libbase.

Change-Id: I0297a6063874b9d92100e0dd5123fddfbda932fe
2015-03-14 16:36:18 -07:00
Elliott Hughes
9d1f515ed1 Fix the WriteStringToFile overload that takes mode/owner/group.
The actual bug is == instead of !=, but the real cause was me trying to be
too clever. This patch switches to much simpler code, and -- since the
intended use of this code is security anyway -- adds logging if anything
goes wrong.

Bug: 19361774
Change-Id: If2af07d31a5002f9010b838247b691f6b28bdfb1
2015-02-17 10:25:23 -08:00
Elliott Hughes
f682b4786a Clean up reading and writing in init.
This isn't particularly useful in and of itself, but it does introduce the
first (trivial) unit test, improves the documentation (including details
about how to debug init crashes), and made me aware of how unpleasant the
existing parser is.

I also fixed a bug in passing --- unless you thought the "peboot" and "pm"
commands were features...

Bug: 19217569
Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
2015-02-06 14:20:30 -08:00
Elliott Hughes
31fa09c1c6 Fix Windows build.
Only two days in, and I'm already really regretting putting this code
somewhere that builds for Mac OS and Windows...

Change-Id: I576ee4a9e647e10dc2d47c7e1e38aedee2bf404c
2015-02-04 19:38:28 -08:00
Elliott Hughes
202f024dee Add a WriteStringToFile overload that cares about permissions.
Change-Id: I857a80b61768d4e9610bdd149eff2d9d8e48d2c0
2015-02-04 14:30:23 -08:00
Elliott Hughes
af4885a4a8 Fix Mac build.
I knew I should have created a new library that doesn't build for the
Mac or Windows rather than adding to libutils...

Change-Id: I7c07eaa93affb7e83d4da384f03652c39065562a
2015-02-03 13:02:57 -08:00
Elliott Hughes
dec12b2b71 Add Google-style ReadFileToString and WriteStringToFile.
Bug: 19217569
Change-Id: I64789d3fa6777ee30a324cdf00fdc275c1230e1b
2015-02-03 12:18:11 -08:00