summaryrefslogtreecommitdiff
path: root/wm/gnome-compiz-manager/patches/patch-aa
blob: e9b15e6db67f0023afe66c0116fca6ef9f42920b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$NetBSD: patch-aa,v 1.1.1.1 2007/04/17 21:44:41 drochner Exp $

--- libgnome-compiz-manager/gcm-application.c.orig	2007-02-27 01:01:01.000000000 +0100
+++ libgnome-compiz-manager/gcm-application.c
@@ -652,6 +652,21 @@ gcm_application_get_pid (GCMApplication 
 {
 #line 248 "gcm-application.gob"
 	
+#ifdef __NetBSD__
+		char *cmd[] = { "/usr/bin/pgrep", 0, 0 };
+		char pgreparg[100]; /* XXX whatever */
+		char *out;
+		int res;
+
+		selfp->pid = 0;
+
+		snprintf(pgreparg, sizeof(pgreparg), "^%s$",
+			 g_path_get_basename(selfp->real_name));
+		cmd[1] = pgreparg;
+		res = g_spawn_sync(0, cmd, 0, 0, 0, 0, &out, 0, 0, 0);
+		if (res)
+			selfp->pid = atoi(out);
+#else
 		GDir * procdir;
 		gchar * item;
 		
@@ -699,6 +714,7 @@ gcm_application_get_pid (GCMApplication 
 			g_free(itemdir);
 		}
 		g_dir_close(procdir);
+#endif /* NetBSD */
 		
 		return selfp->pid;
 	}}