--- a/dpkg-1.17.9/utils/start-stop-daemon.c	2014-04-30 05:57:25.000000000 +0000
+++ b/dpkg-1.17.9.netgear1/utils/start-stop-daemon.c	2014-05-22 17:51:12.000000000 +0000
@@ -31,6 +31,7 @@
 #  define OSHurd
 #elif defined(__sun)
 #  define OSsunos
+#  include <procfs.h>
 #elif defined(OPENBSD) || defined(__OpenBSD__)
 #  define OSOpenBSD
 #elif defined(hpux)
@@ -396,7 +397,7 @@ write_pidfile(const char *filename, pid_
 	if (fp == NULL)
 		fatal("unable to open pidfile '%s' for writing", filename);
 
-	fprintf(fp, "%d\n", pid);
+	fprintf(fp, "%d\n", (int)pid);
 
 	if (fclose(fp))
 		fatal("unable to close pidfile '%s'", filename);
@@ -1184,6 +1185,31 @@ pid_is_exec(pid_t pid, const struct stat
 
 	return (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino);
 }
+#elif defined(OSsunos)
+static bool
+pid_is_exec(pid_t pid, const struct stat *esb)
+{
+	DIR *procdir;
+	struct dirent *entry;
+	char name[_POSIX_PATH_MAX + 1];
+	struct stat sb;
+
+	sprintf(name, "/proc/%d/object", (int)pid);
+	procdir = opendir(name);
+	if (!procdir)
+		return false;
+
+	while ((entry = readdir(procdir)) != NULL) {
+		sprintf(name, "/proc/%d/object/%s", (int)pid, entry->d_name);
+		if (stat(name, &sb) != 0)
+			continue;
+		if (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino)
+			break;
+	}
+	closedir(procdir);
+
+	return (entry != NULL);
+}
 #elif defined(OSHurd)
 static bool
 pid_is_exec(pid_t pid, const struct stat *esb)
@@ -1305,6 +1331,24 @@ pid_is_child(pid_t pid, pid_t ppid)
 
 	return proc_ppid == ppid;
 }
+#elif defined(OSsunos)
+static bool
+pid_is_child(pid_t pid, pid_t ppid)
+{
+	psinfo_t ps;
+	char buf[32];
+	FILE *f;
+
+	sprintf(buf, "/proc/%d/psinfo", (int)pid);
+	f = fopen(buf, "r");
+	if (!f)
+		return false;
+	if (fread(&ps, sizeof(ps), 1, f) != 1)
+		ps.pr_ppid = 0;
+	fclose(f);
+
+	return ps.pr_ppid == ppid;
+}
 #elif defined(OSHurd)
 static bool
 pid_is_child(pid_t pid, pid_t ppid)
@@ -1372,6 +1416,18 @@ pid_is_user(pid_t pid, uid_t uid)
 		return false;
 	return (sb.st_uid == uid);
 }
+#elif defined(OSsunos)
+static bool
+pid_is_user(pid_t pid, uid_t uid)
+{
+	struct stat sb;
+	char buf[32];
+
+	sprintf(buf, "/proc/%d", (int)pid);
+	if (stat(buf, &sb) != 0)
+		return false;
+	return (sb.st_uid == uid);
+}
 #elif defined(OSHurd)
 static bool
 pid_is_user(pid_t pid, uid_t uid)
@@ -1436,6 +1492,24 @@ pid_is_cmd(pid_t pid, const char *name)
 
 	return strcmp(comm, name) == 0;
 }
+#elif defined(OSsunos)
+static bool
+pid_is_cmd(pid_t pid, const char *name)
+{
+	psinfo_t ps;
+	char buf[32];
+	FILE *f;
+
+	sprintf(buf, "/proc/%d/psinfo", (int)pid);
+	f = fopen(buf, "r");
+	if (!f)
+		return false;
+	if (fread(&ps, sizeof(ps), 1, f) != 1)
+		ps.pr_fname[0] = '\0';
+	fclose(f);
+
+	return (!strcmp(name, ps.pr_fname));
+}
 #elif defined(OSHurd)
 static bool
 pid_is_cmd(pid_t pid, const char *name)
@@ -1522,7 +1596,7 @@ pid_is_running(pid_t pid)
 	else if (errno == ESRCH)
 		return false;
 	else
-		fatal("error checking pid %u status", pid);
+		fatal("error checking pid %u status", (unsigned)pid);
 }
 #endif
 
@@ -1592,7 +1666,7 @@ do_procinit(void)
 	while ((entry = readdir(procdir)) != NULL) {
 		enum status_code pid_status;
 
-		if (sscanf(entry->d_name, "%d", &pid) != 1)
+		if (sscanf(entry->d_name, "%d", (int*)&pid) != 1)
 			continue;
 		foundany++;
 
@@ -1834,7 +1908,7 @@ do_stop(int sig_num, int *n_killed, int
 		if (testmode) {
 			if (quietmode <= 0)
 				printf("Would send signal %d to %d.\n",
-				       sig_num, p->pid);
+				       sig_num, (int)p->pid);
 			(*n_killed)++;
 		} else if (kill(p->pid, sig_num) == 0) {
 			pid_list_push(&killed, p->pid);
@@ -1842,7 +1916,7 @@ do_stop(int sig_num, int *n_killed, int
 		} else {
 			if (sig_num)
 				warning("failed to kill %d: %s\n",
-				        p->pid, strerror(errno));
+				        (int)p->pid, strerror(errno));
 			(*n_notkilled)++;
 		}
 	}
@@ -1858,7 +1932,7 @@ do_stop_summary(int retry_nr)
 
 	printf("Stopped %s (pid", what_stop);
 	for (p = killed; p; p = p->next)
-		printf(" %d", p->pid);
+		printf(" %d", (int)p->pid);
 	putchar(')');
 	if (retry_nr > 0)
 		printf(", retry #%d", retry_nr);
