[so] tema 1 so - simple_command_t->params - pointer neintializat ?

Liviu Esanu liviu_esanu at yahoo.com
Sat Apr 10 07:05:11 EEST 2010


Cum vezi daca o comanda are sau nu parametri ? Fara sa iti crape dc se poate ?


--- On Sat, 4/10/10, Liviu Esanu <liviu_esanu at yahoo.com> wrote:

From: Liviu Esanu <liviu_esanu at yahoo.com>
Subject: Re: [so] tema 1 so - simple_command_t->params - pointer neintializat ?
To: "Sisteme de Operare" <so at cursuri.cs.pub.ro>
Date: Saturday, April 10, 2010, 12:34 AM

Va merge apelul root->scmd->params != NULL fara crash ?
A mai intalnit cineva problema aceasta ? 



--- On Thu, 4/8/10, Liviu Esanu <liviu_esanu at yahoo.com> wrote:

From: Liviu Esanu <liviu_esanu at yahoo.com>
Subject: [so] tema 1 so - simple_command_t->params - pointer neintializat ?
To: "Sisteme de Operare" <so at cursuri.cs.pub.ro>
Date: Thursday, April 8, 2010, 5:40 PM

 Dupa
 apelul parse_line(line.c_str() , &root) - in fisierul DisplayStructur.cpp 
in cazul cand root->op == OP_NONE 
daca fac testul if( root->scmd->params != NULL) imi zice Segmentation fault pentru comenzi fara parametri.

Deci pentru comanda ls imi da segmentation fault cand vreaus a verific daca are aprametri ;
Iar petnru comanda ls -a nu da eroare si vede ca are un aprametru (-a).

Presupun ca parserul uita sa initializeze la NULL membrii structurii simple_command_t cand o instantiaza , iar ->params ramane neinitializat cand se parseaza o comanda fara parametri.

In cazul acesta , cum verific daca o comanda parsata are parametri ?



      
-----Inline Attachment Follows-----

_______________________________________________
so mailing list
so at cursuri.cs.pub.ro
http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so



      
-----Inline Attachment Follows-----

_______________________________________________
so mailing list
so at cursuri.cs.pub.ro
http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/lurker/list/so.html/attachments/20100409/f14d4441/attachment-0001.htm>


More information about the so mailing list