]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/vfs/ea.c
Remove bdb env on exit
[netatalk.git] / libatalk / vfs / ea.c
index 0653191f816f335ca9959e85d41ab3e346a1faad..abe266fef978574b0140ef01773b1b6be3927df7 100644 (file)
@@ -1,5 +1,4 @@
 /*
-  $Id: ea.c,v 1.22 2010-04-18 11:11:17 franklahm Exp $
   Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
@@ -515,13 +514,15 @@ static int ea_delentry(struct ea * restrict ea, const char * restrict attruname)
     unsigned int count = 0;
 
     if (ea->ea_count == 0) {
-        LOG(log_error, logtype_afpd, "ea_delentry('%s'): illegal ea_count of 0 on deletion");
+        LOG(log_error, logtype_afpd, "ea_delentry('%s'): illegal ea_count of 0 on deletion",
+            attruname);
         return -1;
     }
 
     while (count < ea->ea_count) {
         /* search matching EA */
-        if (strcmp(attruname, (*ea->ea_entries)[count].ea_name) == 0) {
+        if ((*ea->ea_entries)[count].ea_name &&
+            strcmp(attruname, (*ea->ea_entries)[count].ea_name) == 0) {
             free((*ea->ea_entries)[count].ea_name);
             (*ea->ea_entries)[count].ea_name = NULL;
 
@@ -1097,6 +1098,7 @@ int get_eacontent(VFS_FUNC_ARGS_EA_GETCONTENT)
 
             if (read(fd, rbuf, toread) != (ssize_t)toread) {
                 LOG(log_error, logtype_afpd, "get_eacontent('%s/%s'): short read", uname, attruname);
+                close(fd);
                 ret = AFPERR_MISC;
                 break;
             }