Get root UID in starter_exe.
Starter kept failing before because starter.sh was run as lvuser. This
fix changes the UID to root, which apparently is no longer done by the
NI starter system on the roborio.
Change-Id: I18c4b5b49c1f1de99149840a436418840361a62c
diff --git a/aos/linux_code/starter/starter.cc b/aos/linux_code/starter/starter.cc
index 9893970..86d601e 100644
--- a/aos/linux_code/starter/starter.cc
+++ b/aos/linux_code/starter/starter.cc
@@ -708,6 +708,15 @@
void Main() {
logging::Init();
+ // Set UID to 0 so we can run things as root down below. Since the starter
+ // program on the roborio runs starter.sh under "lvuser", it will continuously
+ // fail due to lack of permissions if we do not manually set the UID to admin.
+#ifdef AOS_ARCHITECTURE_arm_frc
+ if (setuid(0) != 0) {
+ PLOG(FATAL, "setuid(0) failed");
+ }
+#endif
+
if (setpgid(0 /*self*/, 0 /*make PGID the same as PID*/) != 0) {
PLOG(FATAL, "setpgid(0, 0) failed");
}