+/* get the local logged in user */
+static void set_to_local_user(char *user)
+{
+ struct utmp *u;
+ time_t recent = 0;
+
+ strnfieldcpy(user, default_owner_str, OWNER_SIZE);
+ setutent();
+ while (1) {
+ u = getutent();
+ if (u == NULL)
+ break;
+
+ /* is this a user login ? */
+ if (u->ut_type != USER_PROCESS)
+ continue;
+
+ /* is this a local login ? */
+ if (strcmp(u->ut_host, ""))
+ continue;
+
+ if (u->ut_time > recent) {
+ recent = u->ut_time;
+ strnfieldcpy(user, u->ut_user, OWNER_SIZE);
+ dbg("local user is '%s'", user);
+ break;
+ }
+ }
+ endutent();
+}
+
+/* Used to unlink existing files to ensure that our new file/symlink is created */
+static int unlink_entry(char *filename)