Index: uspace/srv/net/nil/eth/eth.c
===================================================================
--- uspace/srv/net/nil/eth/eth.c	(revision 0a3fbc7aaeecfe45b26ba44ae62268c82c8e623d)
+++ uspace/srv/net/nil/eth/eth.c	(revision 0b81cad0360a509d54d5a8a7f64c14e5fb6f91e6)
@@ -42,5 +42,5 @@
 #include <byteorder.h>
 #include <str.h>
-#include <err.h>
+#include <errno.h>
 
 #include <ipc/ipc.h>
@@ -196,5 +196,5 @@
 int nil_initialize(int net_phone)
 {
-	ERROR_DECLARE;
+	int rc;
 
 	fibril_rwlock_initialize(&eth_globals.devices_lock);
@@ -208,12 +208,14 @@
 	    CONVERT_SIZE(uint8_t, char, ETH_ADDR));
 	if (!eth_globals.broadcast_addr) {
-		ERROR_CODE = ENOMEM;
+		rc = ENOMEM;
 		goto out;
 	}
-	if (ERROR_OCCURRED(eth_devices_initialize(&eth_globals.devices))) {
+	rc = eth_devices_initialize(&eth_globals.devices);
+	if (rc != EOK) {
 		free(eth_globals.broadcast_addr);
 		goto out;
 	}
-	if (ERROR_OCCURRED(eth_protos_initialize(&eth_globals.protos))) {
+	rc = eth_protos_initialize(&eth_globals.protos);
+	if (rc != EOK) {
 		free(eth_globals.broadcast_addr);
 		eth_devices_destroy(&eth_globals.devices);
@@ -223,5 +225,5 @@
 	fibril_rwlock_write_unlock(&eth_globals.devices_lock);
 	
-	return ERROR_CODE;
+	return rc;
 }
 
@@ -234,7 +236,6 @@
 static void eth_receiver(ipc_callid_t iid, ipc_call_t *icall)
 {
-	ERROR_DECLARE;
-
 	packet_t packet;
+	int rc;
 
 	while (true) {
@@ -246,11 +247,11 @@
 			break;
 		case NET_NIL_RECEIVED:
-			if (ERROR_NONE(packet_translate_remote(
-			    eth_globals.net_phone, &packet,
-			    IPC_GET_PACKET(icall)))) {
-				ERROR_CODE = nil_received_msg_local(0,
+			rc = packet_translate_remote(eth_globals.net_phone,
+			    &packet, IPC_GET_PACKET(icall));
+			if (rc == EOK) {
+				rc = nil_received_msg_local(0,
 				    IPC_GET_DEVICE(icall), packet, 0);
 			}
-			ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
+			ipc_answer_0(iid, (ipcarg_t) rc);
 			break;
 		default:
@@ -282,6 +283,4 @@
 eth_device_message(device_id_t device_id, services_t service, size_t mtu)
 {
-	ERROR_DECLARE;
-
 	eth_device_ref device;
 	int index;
@@ -300,4 +299,5 @@
 	char *data;
 	eth_proto_ref proto;
+	int rc;
 
 	fibril_rwlock_write_lock(&eth_globals.devices_lock);
@@ -351,9 +351,10 @@
 
 	configuration = &names[0];
-	if (ERROR_OCCURRED(net_get_device_conf_req(eth_globals.net_phone,
-	    device->device_id, &configuration, count, &data))) {
+	rc = net_get_device_conf_req(eth_globals.net_phone, device->device_id,
+	    &configuration, count, &data);
+	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&eth_globals.devices_lock);
 		free(device);
-		return ERROR_CODE;
+		return rc;
 	}
 	if (configuration) {
@@ -387,9 +388,10 @@
 	
 	// get hardware address
-	if (ERROR_OCCURRED(netif_get_addr_req(device->phone, device->device_id,
-	    &device->addr, &device->addr_data))) {
+	rc = netif_get_addr_req(device->phone, device->device_id, &device->addr,
+	    &device->addr_data);
+	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&eth_globals.devices_lock);
 		free(device);
-		return ERROR_CODE;
+		return rc;
 	}
 	
@@ -429,6 +431,4 @@
 static eth_proto_ref eth_process_packet(int flags, packet_t packet)
 {
-	ERROR_DECLARE;
-
 	eth_header_snap_ref header;
 	size_t length;
@@ -437,5 +437,6 @@
 	size_t suffix;
 	eth_fcs_ref fcs;
-	uint8_t * data;
+	uint8_t *data;
+	int rc;
 
 	length = packet_get_data_length(packet);
@@ -488,14 +489,17 @@
 	
 	if (IS_DUMMY(flags)) {
-		if ((~compute_crc32(~0U, data, length * 8)) != ntohl(*fcs))
+		if (~compute_crc32(~0U, data, length * 8) != ntohl(*fcs))
 			return NULL;
 		suffix += sizeof(eth_fcs_t);
 	}
 	
-	if (ERROR_OCCURRED(packet_set_addr(packet,
-	    header->header.source_address, header->header.destination_address,
-	    ETH_ADDR)) || ERROR_OCCURRED(packet_trim(packet, prefix, suffix))) {
+	rc = packet_set_addr(packet, header->header.source_address,
+	    header->header.destination_address, ETH_ADDR);
+	if (rc != EOK)
 		return NULL;
-	}
+
+	rc = packet_trim(packet, prefix, suffix);
+	if (rc != EOK)
+		return NULL;
 	
 	return eth_protos_find(&eth_globals.protos, type);
@@ -781,10 +785,9 @@
 eth_send_message(device_id_t device_id, packet_t packet, services_t sender)
 {
-	ERROR_DECLARE;
-
 	eth_device_ref device;
 	packet_t next;
 	packet_t tmp;
 	int ethertype;
+	int rc;
 
 	ethertype = htons(protocol_map(SERVICE_ETHERNET, sender));
@@ -804,6 +807,7 @@
 	next = packet;
 	do {
-		if (ERROR_OCCURRED(eth_prepare_packet(device->flags, next,
-		    (uint8_t *) device->addr->value, ethertype, device->mtu))) {
+		rc = eth_prepare_packet(device->flags, next,
+		    (uint8_t *) device->addr->value, ethertype, device->mtu);
+		if (rc != EOK) {
 			// release invalid packet
 			tmp = pq_detach(next);
@@ -832,6 +836,4 @@
     ipc_call_t *answer, int *answer_count)
 {
-	ERROR_DECLARE;
-	
 	measured_string_ref address;
 	packet_t packet;
@@ -840,4 +842,5 @@
 	size_t suffix;
 	size_t content;
+	int rc;
 	
 	*answer_count = 0;
@@ -850,11 +853,15 @@
 		    IPC_GET_SERVICE(call), IPC_GET_MTU(call));
 	case NET_NIL_SEND:
-		ERROR_PROPAGATE(packet_translate_remote(eth_globals.net_phone,
-		    &packet, IPC_GET_PACKET(call)));
+		rc = packet_translate_remote(eth_globals.net_phone, &packet,
+		    IPC_GET_PACKET(call));
+		if (rc != EOK)
+			return rc;
 		return eth_send_message(IPC_GET_DEVICE(call), packet,
 		    IPC_GET_SERVICE(call));
 	case NET_NIL_PACKET_SPACE:
-		ERROR_PROPAGATE(eth_packet_space_message(IPC_GET_DEVICE(call),
-		    &addrlen, &prefix, &content, &suffix));
+		rc = eth_packet_space_message(IPC_GET_DEVICE(call), &addrlen,
+		    &prefix, &content, &suffix);
+		if (rc != EOK)
+			return rc;
 		IPC_SET_ADDR(answer, addrlen);
 		IPC_SET_PREFIX(answer, prefix);
@@ -864,10 +871,14 @@
 		return EOK;
 	case NET_NIL_ADDR:
-		ERROR_PROPAGATE(eth_addr_message(IPC_GET_DEVICE(call),
-		    ETH_LOCAL_ADDR, &address));
+		rc = eth_addr_message(IPC_GET_DEVICE(call), ETH_LOCAL_ADDR,
+		    &address);
+		if (rc != EOK)
+			return rc;
 		return measured_strings_reply(address, 1);
 	case NET_NIL_BROADCAST_ADDR:
-		ERROR_PROPAGATE(eth_addr_message(IPC_GET_DEVICE(call),
-		    ETH_BROADCAST_ADDR, &address));
+		rc = eth_addr_message(IPC_GET_DEVICE(call), ETH_BROADCAST_ADDR,
+		    &address);
+		if (rc != EOK)
+			return EOK;
 		return measured_strings_reply(address, 1);
 	case IPC_M_CONNECT_TO_ME:
@@ -923,9 +934,9 @@
 int main(int argc, char *argv[])
 {
-	ERROR_DECLARE;
+	int rc;
 	
 	/* Start the module */
-	ERROR_PROPAGATE(nil_module_start_standalone(nil_client_connection));
-	return EOK;
+	rc = nil_module_start_standalone(nil_client_connection);
+	return rc;
 }
 
