rem: if (PrintNewline) fprintf(stdout, "%s\n", value); else fprintf(stdout, "%s", value);
add: rc=fclose(fp); if (rc != 0) fprintf(stderr, ERR_UNKNOWN_WRITING, errno, outname); } if (rc==0 && !Quiet) { if (PrintName) { fprintf(stdout, "%s = %s\n", outname, value); } else { if (PrintNewline) fprintf(stdout, "%s\n", value); else fprintf(stdout, "%s", value); }
context: static int WriteSetting(const char *setting) {   int rc = 0;   const char *name = setting;   const char *value;   const char *equals;   char *tmpname;   FILE *fp;   char *outname;   if (!name) {        /* probably don't want to display this err */      return 0;   } /* end if */   equals = index(setting, '=');    if (!equals) {      fprintf(stderr, ERR_NO_EQUALS, setting);      return -1;   }   value = equals + 1;      /* point to the value in name=value */      if (!*name || !*value || name == equals) {       fprintf(stderr, ERR_MALFORMED_SETTING, setting);      return -2;   }   /* used to open the file */   tmpname = malloc(equals-name+1+strlen(PROC_PATH));   strcpy(tmpname, PROC_PATH);   strncat(tmpname, name, (int)(equals-name));    tmpname[equals-name+strlen(PROC_PATH)] = 0;   slashdot(tmpname+strlen(PROC_PATH),'.','/'); /* change . to / */   /* used to display the output */   outname = malloc(equals-name+1);                          strncpy(outname, name, (int)(equals-name));    outname[equals-name] = 0;   slashdot(outname,'/','.'); /* change / to . */    fp = fopen(tmpname, "w");   if (!fp) {      switch(errno) {      case ENOENT:         if (!IgnoreError) {            fprintf(stderr, ERR_INVALID_KEY, outname);            rc = -1;         }         break;      case EACCES:         fprintf(stderr, ERR_PERMISSION_DENIED, outname);         rc = -1;         break;      default:         fprintf(stderr, ERR_UNKNOWN_WRITING, errno, outname);         rc = -1;         break;      }   } else {      fprintf(fp, "%s\n", value);      fclose(fp);      if (PrintName) {         fprintf(stdout, "%s = %s\n", outname, value);      } else {         if (PrintNewline)            fprintf(stdout, "%s\n", value);         else            fprintf(stdout, "%s", value);      }   }   free(tmpname);   free(outname);   return rc;}