gnome-keyring r1695 - in trunk: . pkcs11/rpc-layer



Author: nnielsen
Date: Fri Mar 20 22:02:46 2009
New Revision: 1695
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1695&view=rev

Log:
Don't use err.h since Solaris doesn't have it.

Fixes bug #575829

Modified:
   trunk/ChangeLog
   trunk/pkcs11/rpc-layer/gck-rpc-daemon-standalone.c

Modified: trunk/pkcs11/rpc-layer/gck-rpc-daemon-standalone.c
==============================================================================
--- trunk/pkcs11/rpc-layer/gck-rpc-daemon-standalone.c	(original)
+++ trunk/pkcs11/rpc-layer/gck-rpc-daemon-standalone.c	Fri Mar 20 22:02:46 2009
@@ -28,7 +28,6 @@
 #include "gck-rpc-layer.h"
 
 #include <stdio.h>
-#include <err.h>
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -54,7 +53,7 @@
 static int 
 usage (void)
 {
-	fprintf (stderr, "usage: gck-rpc-daemon pkcs11-module");
+	fprintf (stderr, "usage: gck-rpc-daemon pkcs11-module\n");
 	exit (2);
 }
 
@@ -74,25 +73,32 @@
 
 	/* Load the library */
 	module = dlopen(argv[1], RTLD_NOW);
-	if(!module) 
-		errx (1, "couldn't open library: %s: %s", argv[1], dlerror());
+	if(!module) {
+		fprintf (stderr, "couldn't open library: %s: %s\n", argv[1], dlerror());
+		exit (1);
+	}
 
 	/* Lookup the appropriate function in library */
 	func_get_list = (CK_C_GetFunctionList)dlsym (module, "C_GetFunctionList");
-	if (!func_get_list)
-		errx (1, "couldn't find C_GetFunctionList in library: %s: %s", 
-		      argv[1], dlerror());
+	if (!func_get_list) {
+		fprintf (stderr, "couldn't find C_GetFunctionList in library: %s: %s\n", argv[1], dlerror());
+		exit (1);
+	}
 	
 	/* Get the function list */
 	rv = (func_get_list) (&funcs);
-	if (rv != CKR_OK || !funcs)
-		errx (1, "couldn't get function list from C_GetFunctionList in libary: %s: 0x%08x", 
-		      argv[1], (int)rv);
+	if (rv != CKR_OK || !funcs) {
+		fprintf (stderr, "couldn't get function list from C_GetFunctionList in libary: %s: 0x%08x\n", 
+		         argv[1], (int)rv);
+		exit (1);
+	}
 	
 	/* RPC layer expects initialized module */
 	rv = (funcs->C_Initialize) (&p11_init_args);
-	if (rv != CKR_OK) 
-		errx (1, "couldn't initialize module: %s: 0x%08x", argv[1], (int)rv);
+	if (rv != CKR_OK) {
+		fprintf (stderr, "couldn't initialize module: %s: 0x%08x\n", argv[1], (int)rv);
+		exit (1);
+	}
 	
 	sock = gck_rpc_layer_initialize (SOCKET_PATH, funcs);
 	if (sock == -1)
@@ -106,7 +112,8 @@
 		if (ret < 0) {
 			if (errno == EINTR)
 				continue;
-			err (1, "error watching socket");
+			fprintf (stderr, "error watching socket: %s\n", strerror (errno));
+			exit (1);
 		}
 		
 		if (FD_ISSET (sock, &read_fds))
@@ -117,7 +124,7 @@
 	
 	rv = (funcs->C_Finalize) (NULL);
 	if (rv != CKR_OK)
-		warnx ("couldn't finalize module: %s: 0x%08x", argv[1], (int)rv);
+		fprintf (stderr, "couldn't finalize module: %s: 0x%08x\n", argv[1], (int)rv);
 	
 	dlclose(module);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]