Article View: es.comp.os.linux.programacion
Article #9723Re: Dudas con execvp y hwclock en C
From: J.A. Gutierrez
Date: Wed, 22 May 2002 17:43
Date: Wed, 22 May 2002 17:43
30 lines
1843 bytes
1843 bytes
Angel <anlismon.quita@esto.hotmail.com> wrote:
: /Inicializamos el comando*/
: hwclock[0]=(char *) calloc(14,sizeof(char));
: strcpy(hwclock[0],"/sbin/hwclock");
: hwclock[1]=(char *) calloc(3,sizeof(char));
: strcpy(hwclock[1],"-w");
: hwclock[2]=0x0;
por que no usas strdup ?
O mas mejor
char *hwclock[3]={"hwclock","-w",NULL};
execvp ( hwclock[0], &hwclock[0] );
No deberia haber problema; a no ser que hayas corrompido la
memoria entre tanto...
Por otra parte, si el programa que estas haciendo es setuid
no deberias usar system().
--
PGP and other useless info at \
http://www.cps.unizar.es/~spd/ \
finger://daphne.cps.unizar.es/spd \ Timeo Danaos et dona ferentes
ftp://ivo.cps.unizar.es/pub/ \ (Virgilio)
Technical Details
Message-ID:
<acglc9$rlt$1@news.unizar.es>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!xmission!news-out.spamkiller.net!propagator2-maxim!propagator-maxim!news-in.spamkiller.net!news.telia-iberia.com!news.rediris.es!news.unizar.es!not-for-mailReferences:
<9AqG8.28727$GE2.346005@telenews.teleline.es>Show Full Headers
Complete Article Headers
X-Google-Language: PORTUGUESE,ASCII-7-bit
X-Google-Thread: f86c8,b3d179b3cb74b2b
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-05-22 10:14:37 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!xmission!news-out.spamkiller.net!propagator2-maxim!propagator-maxim!news-in.spamkiller.net!news.telia-iberia.com!news.rediris.es!news.unizar.es!not-for-mail
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Dudas con execvp y hwclock en C
Date: 22 May 2002 17:43:37 GMT
Organization: Rank
Lines: 30
Message-ID: <acglc9$rlt$1@news.unizar.es>
References: <9AqG8.28727$GE2.346005@telenews.teleline.es>
NNTP-Posting-Host: daphne.cps.unizar.es
X-Trace: news.unizar.es 1022089417 28349 155.210.152.20 (22 May 2002 17:43:37 GMT)
X-Complaints-To: usenet@news.unizar.es
NNTP-Posting-Date: 22 May 2002 17:43:37 GMT
User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (IRIX/6.2 (IP22))