init: enable error reporting of builtin functions

Enable error reporting when builtin functions fail.  These errors are
now reported with full context including the source file and line
number, e.g.

init: Command 'write /sys/module/subsystem_restart/parameters/enable_debug ${persist.sys.ssr.enable_debug}' action=early-boot (/init.bullhead.rc:84) took 0ms and failed: cannot expand '${persist.sys.ssr.enable_debug}'

There are two small caveats:
1) There are nearly 200 reports of builtins failure due to "No such
   file or directory".  Many of these are due to legacy paths included
   in rootdir/init.rc.  Until they are cleaned up, reporting of these
   failures is disabled.
2) Similarly, symlink is often used to create backwards compatible
   symlinks.  By their very nature, these calls are expected to fail
   on newer systems that do already use the new path.  Due to this,
   failures of symlink due to EEXIST are not reported.

Bug: 38038887
Test: boot bullhead, only see true errors reported from builtins.
Change-Id: I316c13e3adc992cacc6d79ffee987adc8738fca0
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 3d0ba55..54ccf09 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -612,6 +612,11 @@
 
 static Result<Success> do_symlink(const std::vector<std::string>& args) {
     if (symlink(args[1].c_str(), args[2].c_str()) < 0) {
+        // The symlink builtin is often used to create symlinks for older devices to be backwards
+        // compatible with new paths, therefore we skip reporting this error.
+        if (errno == EEXIST && android::base::GetMinimumLogSeverity() > android::base::DEBUG) {
+            return Success();
+        }
         return ErrnoError() << "symlink() failed";
     }
     return Success();