Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 127723 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-16 / +12 lines)
Line  Link Here
0
-- fontforge/autosave.c
0
++ fontforge/autosave.c
Lines 48-59 return( dir = g_get_home_dir()); Link Here
48
# include <pwd.h>
48
# include <pwd.h>
49
49
50
static char *gethomedir(void) {
50
static char *gethomedir(void) {
51
    static char *dir=NULL;
51
    static char *dir;
52
    int uid;
52
    int uid;
53
    struct passwd *pw;
53
    struct passwd *pw;
54
54
55
	dir = getenv("HOME");
55
    if ( dir!=NULL )
56
    if ( dir!=NULL )
56
return( dir );
57
return( strdup(dir) );
57
58
58
    uid = getuid();
59
    uid = getuid();
59
    while ( (pw=getpwent())!=NULL ) {
60
    while ( (pw=getpwent())!=NULL ) {
Lines 65-85 return( dir ); Link Here
65
    }
66
    }
66
    endpwent();
67
    endpwent();
67
68
68
    if ( (dir=getenv("HOME"))!=NULL )
69
return( (dir=strdup(dir)) );
70
71
return( NULL );
69
return( NULL );
72
}
70
}
73
#endif
71
#endif
74
72
75
char *getPfaEditDir(char *buffer) {
73
char *getPfaEditDir(char *buffer) {
76
    static char *dir=NULL;
74
    char *dir=gethomedir();
77
75
78
    if ( dir!=NULL )
76
    if ( dir==NULL )
79
return( dir );
80
    if ( gethomedir()==NULL )
81
return( NULL );
77
return( NULL );
82
    sprintf(buffer,"%s/.PfaEdit", gethomedir());
78
    sprintf(buffer,"%s/.PfaEdit", dir);
79
    free(dir);
83
    if ( access(buffer,F_OK)==-1 )
80
    if ( access(buffer,F_OK)==-1 )
84
	if ( mkdir(buffer,0700)==-1 )
81
	if ( mkdir(buffer,0700)==-1 )
85
return( NULL );
82
return( NULL );
Lines 88-100 return( dir ); Link Here
88
}
85
}
89
86
90
static char *getAutoDirName(char *buffer) {
87
static char *getAutoDirName(char *buffer) {
91
    static char *dir=NULL;
88
    char *dir=getPfaEditDir(buffer);
92
89
93
    if ( dir!=NULL )
90
    if ( dir==NULL )
94
return( dir );
95
    if ( getPfaEditDir(buffer)==NULL )
96
return( NULL );
91
return( NULL );
97
    sprintf(buffer,"%s/autosave", getPfaEditDir(buffer));
92
    sprintf(buffer,"%s/autosave", dir);
93
    free(dir);
98
    if ( access(buffer,F_OK)==-1 )
94
    if ( access(buffer,F_OK)==-1 )
99
	if ( mkdir(buffer,0700)==-1 )
95
	if ( mkdir(buffer,0700)==-1 )
100
return( NULL );
96
return( NULL );

Return to bug 127723