delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/06/13/22:53:31

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <675149.63397.qm@web110509.mail.gq1.yahoo.com>
Date: Sat, 13 Jun 2009 19:53:10 -0700 (PDT)
From: Xiaoqiang Zheng <zh_xq AT yahoo DOT com>
Subject: Re: [BUG 1.7 getopt_long() and recv()] has problem for tftp-hpa-5.0 on cygwin-1.7/win2003
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

to make the 2 BUGs more clear:

* in the while loop of processing options with '-' using getopt_long():  

$ tftpd/tftpd -u SYSTEM -L -vvvv -p -c -s /var/log

1. it seems the '-<x> <value>'(-u SYSTEM) argument pairs that pass the second argument as value have the value lost and the variable get null value. the '-<x>'(-L -p -c -s; -vvvv is a special one) type arguments that set some flag seems work well.

2. the value of 'optind'  is always 1 in each loop(-vvvv is a special one?). but it would have be increased by 1 in each loop.  after all the '-<x>' and '-<x> <value>' arguments being processed, its value. 

3. because the value of optind not increased 1 for each loop, so that the arguments '/var/log' at the end that pass value(s) get processed in a wrong way as the optind is used for 'argv[optind]' to set value to some variable(s).


==================
$ tftpd/tftpd -u SYSTEM -L -vvvv -p -c -s /var/log
cygwin: user=(null)  optarg=(null)  optind=1
cygwin: standalone=1  optind=1
cygwin: nodaemon=1  optind=1
cygwin: verbosity=1  optind=1
cygwin: verbosity=2  optind=1
cygwin: verbosity=3  optind=1
cygwin: verbosity=4  optind=1
cygwin: uniperm=1  optind=1
cygwin: cancreate=1  optind=1
cygwin: secure=1  optind=1
cygwin: dirs[0]=-u  argv[1]=-u
cygwin: dirs[1]=SYSTEM  argv[2]=SYSTEM
cygwin: dirs[2]=-L  argv[3]=-L
cygwin: dirs[3]=-vvvv  argv[4]=-vvvv
cygwin: dirs[4]=-p  argv[5]=-p
cygwin: dirs[5]=-c  argv[6]=-c
cygwin: dirs[6]=-s  argv[7]=-s
cygwin: dirs[7]=/var/log  argv[8]=/var/log
==================
$ tftpd/tftpd --user SYSTEM --foreground --verbose --verbose --verbose --verbos
e --permissive --create --secure /var/log
cygwin: user=(null)  optarg=(null)  optind=1
cygwin: standalone=1  optind=1
cygwin: nodaemon=1  optind=1
cygwin: verbosity=1  optind=1
cygwin: verbosity=2  optind=1
cygwin: verbosity=3  optind=1
cygwin: verbosity=4  optind=1
cygwin: uniperm=1  optind=1
cygwin: cancreate=1  optind=1
cygwin: secure=1  optind=1
cygwin: dirs[0]=--user  argv[1]=--user
cygwin: dirs[1]=SYSTEM  argv[2]=SYSTEM
cygwin: dirs[2]=--foreground  argv[3]=--foreground
cygwin: dirs[3]=--verbose  argv[4]=--verbose
cygwin: dirs[4]=--verbose  argv[5]=--verbose
cygwin: dirs[5]=--verbose  argv[6]=--verbose
cygwin: dirs[6]=--verbose  argv[7]=--verbose
cygwin: dirs[7]=--permissive  argv[8]=--permissive
cygwin: dirs[8]=--create  argv[9]=--create
cygwin: dirs[9]=--secure  argv[10]=--secure
cygwin: dirs[10]=/var/log  argv[11]=/var/log
==================



* recv() returns -1 with error 14 when it read acknolege packet from the socket, the normal return value is 4.

==================
cygwin: recv() rv = -1  errno=14
cygwin: recv() rv = -1  errno=14
==================



      

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019