IPC The sleeping barber problem in C feedback I would love to get some feedback on this Sleeping barber implementation in C.
the entire project can be found here: https://github.com/T0iS/sleeping-barber
    How to run. 

1. make
2. start the server on a selected port ( ./server XXXX)
3. start the client on localhost and connect to the previously specified port (./holic_cl localhost XXXX)

I would love to hear some advice on the code quality in general, what to do, what not to do and/or how could I improve the code stability and quality or readability as well.
Editing the question and specifying the code parts, did not know about that rule, thanks for letting me know.
The most important parts are these.
The readline function that reads a line from a FD
int readline(fdStruct&amp; fd, char* buf){

    int ret, mv;
    char temp[256];
    bzero(temp, sizeof(temp));
    char* t = NULL;

    while(1){
        bzero(temp, sizeof(temp));
        bzero(buf,sizeof(buf));

        ret = read(fd.fd, &amp;temp, 256 - sizeof(strlen(fd.BUF)));
        if (ret &gt; 0 ){
            temp[ret] = '\0';
        }

        strcat(fd.BUF, temp);
        t = strchr(fd.BUF,'\n');

        if (t != NULL){
            mv = t-fd.BUF+1;
            strncpy(buf,fd.BUF, mv);
            strcpy(fd.BUF,fd.BUF+mv);
            return strlen(buf);
        }
        if (ret &lt;= 0) {

            if (strlen(fd.BUF) == 0){
                return ret;
            }
            strcpy(buf, fd.BUF);
            strcpy(fd.BUF,fd.BUF+strlen(buf));
            return strlen(buf);
        }
    }
}  


The other one the actual barber code (and also the customer one, not including that one since it would be too long)
void* holic(void* arg){

    if(global_data-&gt;child_count&gt;0){
        close(comPipe[1]);
    }
    log_msg(LOG_INFO, &quot;Getting to work..&quot;);

    msg m;
    char l[256];
    int val_check = -1;
    int cut_time = 0;

    global_data-&gt;customer_count = 0;


    while(1){

        sem_getvalue(sem_customers, &amp;val_check);
        if (val_check==0){
            log_msg(LOG_INFO,&quot;Sleeping..&quot;);
        }

        sem_wait(sem_customers);

        log_msg(LOG_INFO, &quot;Woke up, start cutting..&quot;);
        global_data-&gt;customer_count -= 1;

        
        sem_post(sem_barber);

        
        bzero(l,sizeof(l));
        bzero(m.text, sizeof(m.text));
        log_msg(LOG_INFO, &quot;barber before read %d&quot;, fd_pipe.fd);
        
        int tmp = read(comPipe[0], l, sizeof(l));
        l[tmp] = '\0';
        //wait_for_message(fd_pipe,l,&amp;m,'A', AI_Zakazka);


        sscanf(l, &quot;Cut me for %d seconds&quot;, &amp;cut_time);
        global_data-&gt;chairs[global_data-&gt;last_chair] = 0;
        log_msg(LOG_INFO, &quot;Cutting hair, customer on chair %d, duration %d sec.&quot;,global_data-&gt;last_chair, cut_time);
        

        sleep(cut_time);
        sem_post(sem_cutting);

        bzero(l,sizeof(l));
        bzero(m.text, sizeof(m.text));
        

        wait_for_message(fd_pipe,l,&amp;m,'A', AI_Nashledanou);
        log_msg(LOG_INFO, &quot;Goodbye.&quot;);

    }
    if (global_data-&gt;child_count&gt;0){
        close(comPipe[0]);
    }
}

Thanks for every input!
readline

buf is a pointer. sizeof(buf) is either 8 or 4, depending on the architecture. bzero(buf,sizeof(buf)); only clears 8 (or 4) bytes of the buffer.

Similarly, sizeof(strlen(fd.BUF)) is equal to sizeof(int), and 256 - sizeof(strlen(fd.BUF) always evaluates to 252, regardless of the fd.BUF contents. Doesn't look right, and may lead to a buffer overrun.

Looking for '\n' in fd.BUF may degrade the performance. Looking for it in temp would be faster (because temp is smaller).

I don't see why do you need temp at all. It only introduces an extra copy. You may read directly to fd.BUF.

strcpy(fd.BUF,fd.BUF+mv) is very dangerous, and technically introduces an undefined behaviour: strcpy is declared as
  cher * stpcpy(char * dst, const char * src);

The const states a contract, that the source string is not modified. You invocation violates the contract.