Whamcloud - gitweb
LU-2144 utils: reset 'optind' to avoid segmentation fault
authorFan Yong <yong.fan@whamcloud.com>
Thu, 11 Oct 2012 09:12:12 +0000 (17:12 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 12 Oct 2012 22:22:27 +0000 (18:22 -0400)
commit0d8a372d30572077fbf943c7d3f32e3d5d7ee3d5
treeb55a1b139071e6ff3ba2af34d621b2427f43d949
parent82a0cc9ee5489340406a6fc64494f37989099729
LU-2144 utils: reset 'optind' to avoid segmentation fault

Sometimes lfsck_{start,stop} commands may be called several
times under the same lctl shell. Under such case, the function
getopt_long() called inside the lfsck_start/lfsck_stop may be
confused, and cause segmentation fault. So reset the external
variable 'optind' by force to avoid the segmentation fault.

Signed-off-by: Fan Yong <yong.fan@whamcloud.com>
Change-Id: I35b635eac44854ae4b17ae00bed778320dbe9d9e
Reviewed-on: http://review.whamcloud.com/4248
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/utils/lustre_lfsck.c