🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #8908

¿Por qué da un Segmentation Fault?

#8908
From: Jordi
Date: Mon, 16 Sep 2002 16:41
27 lines
1775 bytes
Hola, ejecuto esta tonteria de codigo y me devuelve un Segmentation Fault:

/////////////
#include <stdio.h>
#include <semaphore.h>

int main(int argc, char **argv)
{
   sem_t sem;
   sem_init(&sem, 1, 1);
   sem_wait(&sem);

   return 1;
}
/////////

Lo compilo con:
cc -c -o prueba.o prueba.c
gcc -g -Wall -pthread -O2 -o prueba prueba.o

El semaforo lo inicializo a 1. Al hacer wait se decrementa a cero y 
sigue con la ejecuci�n, en teor�a.


-- 
Ad�u.
Jordi Catal�n Morros
Technical Details
Message-ID: <am51kh$dt4$1@nsnmpen2-gest.nuria.telefonica-data.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!easynews.net!newsfeed3.easynews.net!fu-berlin.de!nsnmpen1-lo.nuria.telefonica-data.net!nsnmpen2-lo.nuria.telefonica-data.net!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,b9a6d11d918e2af1,start
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-09-16 09:41:55 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!easynews.net!newsfeed3.easynews.net!fu-berlin.de!nsnmpen1-lo.nuria.telefonica-data.net!nsnmpen2-lo.nuria.telefonica-data.net!not-for-mail
From: Jordi <jordicatalan@navegalia.com>
Newsgroups: es.comp.os.linux.programacion
Subject: ¿Por qué da un Segmentation Fault?
Date: Mon, 16 Sep 2002 18:41:12 +0200
Organization: UPCO
Lines: 28
Message-ID: <am51kh$dt4$1@nsnmpen2-gest.nuria.telefonica-data.net>
NNTP-Posting-Host: 80-24-57-11.uc.nombres.ttd.es
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: nsnmpen2-gest.nuria.telefonica-data.net 1032194514 14244 80.24.57.11 (16 Sep 2002 16:41:54 GMT)
X-Complaints-To: usenet@nsnmpen2-gest.nuria.telefonica-data.net
NNTP-Posting-Date: Mon, 16 Sep 2002 16:41:54 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-AR; rv:1.1) Gecko/20020826
X-Accept-Language: es