Instead of detail how the f variable gets defined, I'm goingo to post the complete file content. Hope that's not a problem, the file is "only" 75 lines.
sqconfig.c
/*
** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
** distribution information.
*/
/*
** $Id: sqconfig.c,v 1.4 1999/12/08 06:00:38 mrsam Exp $
*/
#include "sqwebmail.h"
#include "sqconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
/* Assume all configuration data fits in 256 char buffer. */
static char linebuf[256];
const char *read_sqconfig(const char *dir, const char *configfile, time_t *mtime)
{
char *p=malloc(strlen(dir) + strlen(configfile) + 2);
struct stat stat_buf;
FILE *f;
if (!p) enomem();
strcat(strcat(strcpy(p, dir), "/"), configfile);
f=fopen(p, "r");
free(p);
if (!f) return (0);
if (fstat(fileno(f), &stat_buf) != 0 ||
!fgets(linebuf, sizeof(linebuf), f))
{
fclose(f);
return (0);
}
fclose(f);
if (mtime) *mtime=stat_buf.st_mtime;
linebuf[sizeof(linebuf)-1]=0;
if ((p=strchr(linebuf, '\n')) != 0) *p=0;
return (linebuf);
}
void write_sqconfig(const char *dir, const char *configfile, const char *val)
{
char *p=malloc(strlen(dir) + strlen(configfile) + 2);
FILE *f;
if (!p) enomem();
strcat(strcat(strcpy(p, dir), "/"), configfile);
if (!val)
unlink(p);
else
{
f=fopen(p, "w");
if (!f) enomem();
fprintf(f, "%s\n", val);
fflush(f);
if (ferror(f)) enomem();
fclose(f);
/* Note - umask should already turn off the 077 bits, but
** just in case someone screwed up previously, I'll fix it
** myself */
chmod(p, 0600);
}
free(p);
}
end of sqconfig.c
thanks,
SRosa
David Brown writes:
Sérgio Manuel Rosa writes:
Right.. forgot that. :-)
version - sqwebmail-3.4.0.20021124
sqconfig.c, line 63
if (!f) enomem();
I'm not a coder, but.. reading the sqconfig.c (75 lines) and looking at line
63, it gives me a bad feeling that my server is running out of mem. Could it
be?
Thanks
SRosa

David Brown writes:
Sérgio Manuel Rosa writes:
Hi,
I don't now if this issue was already discussed, but I'm a new coming to this list.
From time to time I get this error when login in to sqwebmail
Internal error (module sqconfig.c, line 63) - contact system administrator
after this screen I press the back buton in my browser and then I can login whitout any problem. Other times I've to give a restart to sqwebmail.
any clues on what ou why this problem occurs?
Thanks
SRosa

Hello SRosa, I don't know what version of sqwebmail you are running. What is at line 63 in sqconfig.c? Thanks, David.




Hello Sergio, how does the variable: "f" get defined? Thanks, David.


_________________________________________
Sérgio Manuel Rosa
Senior Partner
GoSecure
Taguspark - Lisboa Science & Technology Park
Núcleo Central, 20
Tel: +351 21 4228931
Telm: +351 91 618 42 75
email: [EMAIL PROTECTED]
Web: www.gosecure.pt


Reply via email to