View | Details | Raw Unified | Return to bug 27729 | Differences between
and this patch

Collapse All | Expand All

(-)a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/main.c (-2 / +6 lines)
 Lines 75-88   static char* read_pwd_from_file(char *filename) Link Here 
75
{
75
{
76
	FILE *fp;
76
	FILE *fp;
77
	char line[1024];
77
	char line[1024];
78
	int len;
78
	int len = 0;
79
79
80
	if ((fp = fopen(filename, "r")) == NULL)
80
	if ((fp = fopen(filename, "r")) == NULL)
81
		return NULL;
81
		return NULL;
82
	if (fgets(line, 1024, fp) == NULL)
82
	if (fgets(line, 1024, fp) == NULL)
83
		len = 0;
84
	fclose(fp);
85
	if (!len)
83
		return NULL;
86
		return NULL;
84
85
	len = strlen(line);
87
	len = strlen(line);
88
	if (!len)
89
		return NULL;
86
	if (line[len-1] == '\n')
90
	if (line[len-1] == '\n')
87
		line[len-1] = '\0';
91
		line[len-1] = '\0';
88
92

Return to bug 27729