--- a/mpd2src/mpd2sc.cpp
+++ b/mpd2src/mpd2sc.cpp
@@ -175,35 +175,41 @@
         LOGERR("Error: Cannot create socket: " << strerror(errno) << endl);
         goto _leave;
     }
+
     if (remove(SOCK_PATH) == -1 && errno != ENOENT) {
         LOGERR("Error: Cannot remove socket path: " << strerror(errno) << endl);
         goto _close_socket;
     }
+
     memset(&server_addr, 0, sizeof(struct sockaddr_un));
     server_addr.sun_family = AF_UNIX;
     strncpy(server_addr.sun_path, SOCK_PATH, sizeof(server_addr.sun_path) - 1);
 
-    if (bind(g_sockfd, (struct sockaddr *) &server_addr, sizeof(struct sockaddr_un)) == -1) {
+    if (bind(g_sockfd, (struct sockaddr *) &server_addr,
+                            sizeof(struct sockaddr_un)) == -1) {
         LOGERR("Error: Cannot bind to socket: " << strerror(errno) << endl);
         goto _close_socket;
     }
 
-    do {
+    while (!g_quitrequest) {
         len = sizeof(struct sockaddr_un);
         // recvfrom() is a blocking call and will wait for messages to arrive.
         // We are shutting down the socket in the signal catcher in which case
         // recvfrom() shall return 0. As g_quitrequest is set in the signal
         // catcher, the endless loop is quit.
-        num_bytes = recvfrom(g_sockfd, buf, BUF_SIZE, 0, (struct sockaddr *) &client_addr, &len);
-        LOGDEB("HandleUserCmd: Received " << num_bytes << " bytes: " << string(buf, num_bytes) << endl);
+        num_bytes = recvfrom(g_sockfd, buf, BUF_SIZE, 0,
+                            (struct sockaddr *) &client_addr, &len);
 
         if (num_bytes == -1) {
-            LOGERR("Error: Failed to receive from socket: " << strerror(errno) << endl);
+            LOGERR("Error: Failed to receive from socket: " <<
+                            strerror(errno) << endl);
             continue; // Ignore failed request
         }
         if (num_bytes > 0) {
             string response("OK");
 
+            LOGDEB("HandleUserCmd: Received " << num_bytes << " bytes: " <<
+                            string(buf, num_bytes) << endl);
             if (strncmp("play", buf, num_bytes) == 0)
                 pcmsender->Play();
             else if (strncmp("stop", buf, num_bytes) == 0)
@@ -230,7 +236,7 @@
                        strerror(errno) << endl);
             }
         }
-    } while (!g_quitrequest);
+    }
 
 _close_socket:
     if (g_sockfd > 0)