Index: uspace/lib/libfs/libfs.c
===================================================================
--- uspace/lib/libfs/libfs.c	(revision f5209056e979fbdfe341077cedd598173ff0370c)
+++ uspace/lib/libfs/libfs.c	(revision 92f9baca6b223ece5f5e93de7ce2ee6f28a6410d)
@@ -156,5 +156,5 @@
 		next++;		/* eat slash */
 	
-	while (ops->has_children(cur) && next <= last) {
+	while (next <= last && ops->has_children(cur)) {
 		/* collect the component */
 		len = 0;
@@ -198,6 +198,8 @@
 				if (nodep) {
 					if (!ops->link(cur, nodep, component)) {
-						if (lflag & L_CREATE)
-							(void)ops->destroy(nodep);
+						if (lflag & L_CREATE) {
+							(void)ops->destroy(
+							    nodep);
+						}
 						ipc_answer_0(rid, ENOSPC);
 					} else {
@@ -233,5 +235,5 @@
 
 	/* handle miss: excessive components */
-	if (!ops->has_children(cur) && next <= last) {
+	if (next <= last && !ops->has_children(cur)) {
 		if (lflag & (L_CREATE | L_LINK)) {
 			if (!ops->is_directory(cur)) {
