Hei alle
I LTP -
POSIX test, er det en sak i open_posix_testsuite \ samsvar \ Interfaces \ timer_gettime \ speculative/6-1.c
Sitat:
# include <time.h>
# include <stdio.h>
# include <Errno. h>
/ / # include "posixtest.h"
# define BOGUSTID 9999
int main (int argc, char * argv [])
(
timer_t tid;
struct itimerspec sitt;
tid \u003d (timer_t) BOGUSTID;
if (timer_gettime (tid, og dets) \u003d\u003d -1) (
if (EINVAL \u003d\u003d Errno) (
printf ( "FCN tilbake -1 og Errno\u003d\u003d EINVAL \ n ");
/ / return PTS_PASS;
) Else (
printf ( "FCN returneres -1, men Errno! \u003d EINVAL \ n ");
printf ( "mislyktes \ n");
/ / return PTS_FAIL;
)
)
printf ( "FCN kom ikke tilbake -1 \ n");
/ / return PTS_PASS;
)
|
Jeg kjører over koden, det vil har et segment feil, hvis jeg endre den til under, fungerer det godt
Sitat:
# include <time.h>
# include <stdio.h>
# include <Errno. h>
/ / # include "posixtest.h"
# define BOGUSTID 9999
int main (int argc, char * argv [])
(
timer_t tid;
struct itimerspec sitt;
int tval \u003d BOGUSTID;
printf ( "% d \ n", tval);
tid \u003d (timer_t) &tval;
printf ( "% d \ n", tid);
if (timer_gettime (tid, og dets) \u003d\u003d -1) (
if (EINVAL \u003d\u003d Errno) (
printf ( "FCN tilbake -1 og Errno\u003d\u003d EINVAL \ n ");
/ / return PTS_PASS;
) Else (
printf ( "FCN returneres -1, men Errno! \u003d EINVAL \ n ");
printf ( "mislyktes \ n");
/ / return PTS_FAIL;
)
)
printf ( "FCN kom ikke tilbake -1 \ n");
/ / Return PTS_PASS;
)
|
Hvem som helst kan fortelle meg hvorfor?