peri mkstemp

D.A.Glynos glynos at dial.pipex.com
Sun Feb 7 16:22:47 EET 1999


re gmt giati to parakatw den douleuei?
Egrapsa 5-6 grammes kwdika gia na ftiaxnei ena temporary file :

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>

main(){
int fd;
char *k;

        k= (char *) malloc(sizeof(k));
        k="/ergasia/temp/koukouXXXXXX";
        umask(022);
        fd=mkstemp(k);
        write(fd,"patates",sizeof("patates"));
        close(fd);
        printf("%i",fd);
        free(k);
}

To parapanw kata to compilation den mou vgazei kanena provlima,
otan omws erxete i wra na to treksw, mou petaei ena poli asximo
segmentation fault. Sto strace oi teleutees grammes lene ta eksis :

geteuid()                               = 0
getuid()                                = 0
getgid()                                = 0
getegid()                               = 0
brk(0x8049778)                          = 0x8049778
brk(0x804a000)                          = 0x804a000
umask(022)                              = 022
getpid()                                = 1136
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++

O gdb mou leei to eksis :
0x4002fe9c in _IO_default_xsputn (f=Cannot access memory at address 0x21.
)

Sinepws ipopsiazomai oti kati den paei kala me tin mkstemp...
Exw libc5.4.46 kai oi teleutees allages pou ekana sto sistima
itan na valw ton kernel 2.2.1 kai ola ta prerequisites tou
EKTOS apo tin g++ kai ton gcc-2.8.1

parevlepsa kati ston kwdika h' h libc mou paei gia petama ?

Euxaristw ek twn proterwn
dimitris

--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users
====================================================================



More information about the Linux-greek-users mailing list