Junio C Hamano wrote: > Hmm, I am getting > > cc1: warnings being treated as errors > lockfile.c:189: error: 'optimize' attribute directive ignored > make: *** [lockfile.o] Error 1 > > from this patch with gcc (Debian 4.3.2-1.1) 4.3.2 Unfortunate. With gcc 4.5 it works, but that isn't too useful. > Aren't "struct lock_file" instances supposed to be reachable from the > linked list, i.e. lock_file_list? Why does valgrind consider that > elements on that list are leaked in the first place? At exit, we walk the lock file list and clear it in the process. Which suggests a cleaner workaround (thanks!): static void remove_lock_file(void) { pid_t me = getpid(); + struct lock_file *p = lock_file_list; - while (lock_file_list) { - if (lock_file_list->owner == me && - lock_file_list->filename[0]) { - if (lock_file_list->fd >= 0) - close(lock_file_list->fd); - unlink_or_warn(lock_file_list->filename); - } - lock_file_list = lock_file_list->next; + while (p) { + if (p->owner == me && + p->filename[0]) { + if (p->fd >= 0) + close(p->fd); + unlink_or_warn(p->filename); + } + p = lock_file_list->next; } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html