--- a/minidlna.c
+++ b/minidlna.c
@@ -421,7 +421,7 @@
 				fname);
 			return -1;
 		}
-		if (uid >= 0)
+		if (uid > 0)
 		{
 			if (chown(dir, uid, -1) != 0)
 				DPRINTF(E_WARN, L_GENERAL, "Unable to change pidfile ownership: %s\n",
@@ -443,7 +443,7 @@
 			"Unable to write to pidfile %s: %s\n", fname);
 		ret = -1;
 	}
-	if (uid >= 0)
+	if (uid > 0)
 	{
 		if (fchown(fileno(pidfile), uid, -1) != 0)
 			DPRINTF(E_WARN, L_GENERAL, "Unable to change pidfile ownership: %s\n",
@@ -483,7 +483,7 @@
 	struct media_dir_s *media_dir;
 	int ifaces = 0;
 	media_types types;
-	uid_t uid = -1;
+	uid_t uid = 0;
 
 	/* first check if "-f" option is used */
 	for (i=2; i<argc; i++)
@@ -694,7 +694,7 @@
 			strcpy(uuidvalue+5, ary_options[i].value);
 			break;
 		case USER_ACCOUNT:
-			uid = strtol(ary_options[i].value, &string, 0);
+			uid = strtoul(ary_options[i].value, &string, 0);
 			if (*string)
 			{
 				/* Symbolic username given, not UID. */
@@ -818,7 +818,7 @@
 			if (i+1 != argc)
 			{
 				i++;
-				uid = strtol(argv[i], &string, 0);
+				uid = strtoul(argv[i], &string, 0);
 				if (*string)
 				{
 					/* Symbolic username given, not UID. */
@@ -943,7 +943,7 @@
 	if (writepidfile(pidfilename, pid, uid) != 0)
 		pidfilename = NULL;
 
-	if (uid >= 0)
+	if (uid > 0)
 	{
 		struct stat st;
 		if (stat(db_path, &st) == 0 && st.st_uid != uid && chown(db_path, uid, -1) != 0)
@@ -951,7 +951,7 @@
 				db_path, uid, strerror(errno));
 	}
 
-	if (uid != -1 && setuid(uid) == -1)
+	if (uid > 0 && setuid(uid) == -1)
 		DPRINTF(E_FATAL, L_GENERAL, "Failed to switch to uid '%d'. [%s] EXITING.\n",
 			uid, strerror(errno));