Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision 32efd865176bfa9c946bb85353ec87e270ab1dda)
+++ uspace/srv/net/net/net.c	(revision 409f5fcf57e9be6c53c95e22f4103ca8670faaf5)
@@ -42,5 +42,4 @@
 #include <ddi.h>
 #include <errno.h>
-#include <err.h>
 #include <malloc.h>
 #include <stdio.h>
@@ -92,5 +91,5 @@
     const char *value)
 {
-	ERROR_DECLARE;
+	int rc;
 	
 	measured_string_ref setting =
@@ -100,7 +99,8 @@
 	
 	/* Add the configuration setting */
-	if (ERROR_OCCURRED(measured_strings_add(configuration, name, 0, setting))) {
+	rc = measured_strings_add(configuration, name, 0, setting);
+	if (rc != EOK) {
 		free(setting);
-		return ERROR_CODE;
+		return rc;
 	}
 	
@@ -110,6 +110,5 @@
 /** Generate new system-unique device identifier.
  *
- * @returns The system-unique devic identifier.
- *
+ * @returns		The system-unique devic identifier.
  */
 static device_id_t generate_new_device_id(void)
@@ -120,5 +119,5 @@
 static int parse_line(measured_strings_ref configuration, char *line)
 {
-	ERROR_DECLARE;
+	int rc;
 	
 	/* From the beginning */
@@ -170,7 +169,8 @@
 	
 	/* Add the configuration setting */
-	if (ERROR_OCCURRED(measured_strings_add(configuration, name, 0, setting))) {
+	rc = measured_strings_add(configuration, name, 0, setting);
+	if (rc != EOK) {
 		free(setting);
-		return ERROR_CODE;
+		return rc;
 	}
 	
@@ -181,6 +181,4 @@
     measured_strings_ref configuration)
 {
-	ERROR_DECLARE;
-	
 	printf("%s: Reading configuration file %s/%s\n", NAME, directory, filename);
 	
@@ -206,21 +204,21 @@
 			if (index >= BUFFER_SIZE) {
 				line[BUFFER_SIZE - 1] = '\0';
-				fprintf(stderr, "%s: Configuration line %u too long: %s\n",
-				    NAME, line_number, line);
+				fprintf(stderr, "%s: Configuration line %u too "
+				    "long: %s\n", NAME, line_number, line);
 				
 				/* No space left in the line buffer */
 				return EOVERFLOW;
-			} else {
-				/* Append the character */
-				line[index] = (char) read;
-				index++;
 			}
+			/* Append the character */
+			line[index] = (char) read;
+			index++;
 		} else {
 			/* On error or new line */
 			line[index] = '\0';
 			line_number++;
-			if (ERROR_OCCURRED(parse_line(configuration, line)))
-				fprintf(stderr, "%s: Configuration error on line %u: %s\n",
-				    NAME, line_number, line);
+			if (parse_line(configuration, line) != EOK) {
+				fprintf(stderr, "%s: Configuration error on "
+				    "line %u: %s\n", NAME, line_number, line);
+			}
 			
 			index = 0;
@@ -270,5 +268,5 @@
 static int net_initialize(async_client_conn_t client_connection)
 {
-	ERROR_DECLARE;
+	int rc;
 	
 	netifs_initialize(&net_globals.netifs);
@@ -278,16 +276,24 @@
 	
 	// TODO: dynamic configuration
-	ERROR_PROPAGATE(read_configuration());
-	
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules,
-	    LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service));
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules,
-	    DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service));
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules,
-	    ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0,
-	    connect_to_service));
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules,
-	    NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0,
-	    connect_to_service));
+	rc = read_configuration();
+	if (rc != EOK)
+		return rc;
+	
+	rc = add_module(NULL, &net_globals.modules, LO_NAME, LO_FILENAME,
+	    SERVICE_LO, 0, connect_to_service);
+	if (rc != EOK)
+		return rc;
+	rc = add_module(NULL, &net_globals.modules, DP8390_NAME,
+	    DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service);
+	if (rc != EOK)
+		return rc;
+	rc = add_module(NULL, &net_globals.modules, ETHERNET_NAME,
+	    ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service);
+	if (rc != EOK)
+		return rc;
+	rc = add_module(NULL, &net_globals.modules, NILDUMMY_NAME,
+	    NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service);
+	if (rc != EOK)
+		return rc;
 	
 	/* Build specific initialization */
@@ -314,21 +320,26 @@
 static int net_module_start(async_client_conn_t client_connection)
 {
-	ERROR_DECLARE;
+	ipcarg_t phonehash;
+	int rc;
 	
 	async_set_client_connection(client_connection);
-	ERROR_PROPAGATE(pm_init());
-	
-	ipcarg_t phonehash;
-	
-	if (ERROR_OCCURRED(net_initialize(client_connection)) ||
-	    ERROR_OCCURRED(REGISTER_ME(SERVICE_NETWORKING, &phonehash))) {
-		pm_destroy();
-		return ERROR_CODE;
-	}
+	rc = pm_init();
+	if (rc != EOK)
+		return rc;
+	
+	
+	rc = net_initialize(client_connection);
+	if (rc != EOK)
+		goto out;
+	
+	rc = REGISTER_ME(SERVICE_NETWORKING, &phonehash);
+	if (rc != EOK)
+		goto out;
 	
 	async_manager();
-	
+
+out:
 	pm_destroy();
-	return EOK;
+	return rc;
 }
 
@@ -415,5 +426,5 @@
 static int start_device(netif_t *netif)
 {
-	ERROR_DECLARE;
+	int rc;
 	
 	/* Mandatory netif */
@@ -456,5 +467,7 @@
 	int io = setting ? strtol(setting->value, NULL, 16) : 0;
 	
-	ERROR_PROPAGATE(netif_probe_req_remote(netif->driver->phone, netif->id, irq, io));
+	rc = netif_probe_req_remote(netif->driver->phone, netif->id, irq, io);
+	if (rc != EOK)
+		return rc;
 	
 	/* Network interface layer startup */
@@ -468,6 +481,8 @@
 		int mtu = setting ? strtol(setting->value, NULL, 10) : 0;
 		
-		ERROR_PROPAGATE(nil_device_req(netif->nil->phone, netif->id, mtu,
-		    netif->driver->service));
+		rc = nil_device_req(netif->nil->phone, netif->id, mtu,
+		    netif->driver->service);
+		if (rc != EOK)
+			return rc;
 		
 		internet_service = netif->nil->service;
@@ -478,6 +493,8 @@
 	switch (netif->il->service) {
 	case SERVICE_IP:
-		ERROR_PROPAGATE(ip_device_req(netif->il->phone, netif->id,
-		    internet_service));
+		rc = ip_device_req(netif->il->phone, netif->id,
+		    internet_service);
+		if (rc != EOK)
+			return rc;
 		break;
 	default:
@@ -485,6 +502,5 @@
 	}
 	
-	ERROR_PROPAGATE(netif_start_req_remote(netif->driver->phone, netif->id));
-	return EOK;
+	return netif_start_req_remote(netif->driver->phone, netif->id);
 }
 
@@ -504,6 +520,4 @@
 static int startup(void)
 {
-	ERROR_DECLARE;
-	
 	const char *conf_files[] = {
 		"lo",
@@ -511,4 +525,5 @@
 	};
 	size_t count = sizeof(conf_files) / sizeof(char *);
+	int rc;
 	
 	size_t i;
@@ -522,11 +537,14 @@
 			return EXDEV;
 		
-		ERROR_PROPAGATE(measured_strings_initialize(&netif->configuration));
+		rc = measured_strings_initialize(&netif->configuration);
+		if (rc != EOK)
+			return rc;
 		
 		/* Read configuration files */
-		if (ERROR_OCCURRED(read_netif_configuration(conf_files[i], netif))) {
+		rc = read_netif_configuration(conf_files[i], netif);
+		if (rc != EOK) {
 			measured_strings_destroy(&netif->configuration);
 			free(netif);
-			return ERROR_CODE;
+			return rc;
 		}
 		
@@ -554,9 +572,17 @@
 		 * and needed modules.
 		 */
-		if ((ERROR_OCCURRED(char_map_add(&net_globals.netif_names,
-		    netif->name, 0, index))) || (ERROR_OCCURRED(start_device(netif)))) {
+		rc = char_map_add(&net_globals.netif_names, netif->name, 0,
+		    index);
+		if (rc != EOK) {
 			measured_strings_destroy(&netif->configuration);
 			netifs_exclude_index(&net_globals.netifs, index);
-			return ERROR_CODE;
+			return rc;
+		}
+		
+		rc = start_device(netif);
+		if (rc != EOK) {
+			measured_strings_destroy(&netif->configuration);
+			netifs_exclude_index(&net_globals.netifs, index);
+			return rc;
 		}
 		
@@ -594,8 +620,7 @@
     int *answer_count)
 {
-	ERROR_DECLARE;
-	
 	measured_string_ref strings;
 	char *data;
+	int rc;
 	
 	*answer_count = 0;
@@ -604,6 +629,8 @@
 		return EOK;
 	case NET_NET_GET_DEVICE_CONF:
-		ERROR_PROPAGATE(measured_strings_receive(&strings, &data,
-		    IPC_GET_COUNT(call)));
+		rc = measured_strings_receive(&strings, &data,
+		    IPC_GET_COUNT(call));
+		if (rc != EOK)
+			return rc;
 		net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings,
 		    IPC_GET_COUNT(call), NULL);
@@ -612,10 +639,12 @@
 		free(data);
 		
-		ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call));
+		rc = measured_strings_reply(strings, IPC_GET_COUNT(call));
 		free(strings);
-		return ERROR_CODE;
+		return rc;
 	case NET_NET_GET_CONF:
-		ERROR_PROPAGATE(measured_strings_receive(&strings, &data,
-		    IPC_GET_COUNT(call)));
+		rc = measured_strings_receive(&strings, &data,
+		    IPC_GET_COUNT(call));
+		if (rc != EOK)
+			return rc;
 		net_get_conf_req(0, &strings, IPC_GET_COUNT(call), NULL);
 		
@@ -623,10 +652,11 @@
 		free(data);
 		
-		ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call));
+		rc = measured_strings_reply(strings, IPC_GET_COUNT(call));
 		free(strings);
-		return ERROR_CODE;
+		return rc;
 	case NET_NET_STARTUP:
 		return startup();
 	}
+	
 	return ENOTSUP;
 }
@@ -670,9 +700,10 @@
 int main(int argc, char *argv[])
 {
-	ERROR_DECLARE;
-	
-	if (ERROR_OCCURRED(net_module_start(net_client_connection))) {
-		fprintf(stderr, "%s: net_module_start error %i\n", NAME, ERROR_CODE);
-		return ERROR_CODE;
+	int rc;
+	
+	rc = net_module_start(net_client_connection);
+	if (rc != EOK) {
+		fprintf(stderr, "%s: net_module_start error %i\n", NAME, rc);
+		return rc;
 	}
 	
Index: uspace/srv/net/net/net_standalone.c
===================================================================
--- uspace/srv/net/net/net_standalone.c	(revision 32efd865176bfa9c946bb85353ec87e270ab1dda)
+++ uspace/srv/net/net/net_standalone.c	(revision 409f5fcf57e9be6c53c95e22f4103ca8670faaf5)
@@ -42,4 +42,5 @@
 #include <ipc/ipc.h>
 #include <ipc/net.h>
+#include <errno.h>
 
 #include <ip_interface.h>
@@ -60,5 +61,5 @@
 int net_initialize_build(async_client_conn_t client_connection)
 {
-	ERROR_DECLARE;
+	int rc;
 	
 	task_id_t task_id = spawn("/srv/ip");
@@ -66,6 +67,8 @@
 		return EINVAL;
 	
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, IP_NAME,
-	    IP_FILENAME, SERVICE_IP, task_id, ip_connect_module));
+	rc = add_module(NULL, &net_globals.modules, IP_NAME,
+	    IP_FILENAME, SERVICE_IP, task_id, ip_connect_module);
+	if (rc != EOK)
+		return rc;
 	
 	if (!spawn("/srv/icmp"))
