]> git.sur5r.net Git - openldap/blobdiff - clients/ud/edit.c
From jon@symas.com - patches for consistent use of directory separators
[openldap] / clients / ud / edit.c
index 88c777c17b5405fd83616f1db0da364f090cb4ac..9e208603837a77df31470154d294888f3382fb3d 100644 (file)
@@ -142,7 +142,8 @@ load_editor( void )
                printf("->load_editor()\n");
 #endif
 
-       sprintf(entry_temp_file, "/tmp/udXXXXXX");
+#ifdef HAVE_MKSTEMP
+       strcpy(entry_temp_file, LDAP_TMPDIR LDAP_DIRSEP "udXXXXXX");
 
        tmpfd = mkstemp(entry_temp_file);
 
@@ -156,6 +157,14 @@ load_editor( void )
                return(-1);
        }
 
+#else
+       fp = tmpfile();
+       if ( fp == NULL ) {
+               perror("tmpfile");
+               return(-1);
+       }
+#endif
+
        fprintf(fp, "## Directory entry of %s\n", Entry.name);
        fprintf(fp, "##\n");
        fprintf(fp, "## Syntax is:\n");
@@ -183,7 +192,7 @@ load_editor( void )
        if (verbose) {
                char    *p;
 
-               if (( p = strrchr( editor, '/' )) == NULL ) {
+               if (( p = strrchr( editor, *LDAP_DIRSEP )) == NULL ) {
                        p = editor;
                } else {
                        ++p;