Currently snap does not validate the directory name and output filename passed with snap options -d and -o respectively. If we pass existing directory which contains files/other subdirectories with -d option, while creating the output (snap.tar.gz) it includes all those files which is wrong. If we pass existing filename with -o option it will override existing file.
Currently snap does not validate the directory name and output filename passed
with snap options -d and -o respectively. If we pass existing directory which
contains files/other subdirectories with -d option, while creating the output
(snap.tar.gz) it includes all those files which is wrong. If we pass existing
filename with -o option it will override existing file.

This patch fixes above mentioned issue by validating input parameter
passed to snap command.

Signed-off-by: Vasant Hegde <c0006a0ec120de009f2f3c0249f32324ab2f55aa@linux.vnet.ibm.com>

kamalesh-babulal/powerpc-utils,mdroth/powerpc-utils,leitao/powerpc-ibm-utils-debian,leitao/powerpc-ibm-utils-debian,leitao/powerpc-ibm-utils-debian,mdroth/powerpc-utils,kamalesh-babulal/powerpc-utils,shenki/powerpc-utils,tyreld/powerpc-utils,tyreld/powerpc-utils,tyreld/powerpc-utils,shenki/powerpc-utils,shenki/powerpc-utils,mdroth/powerpc-utils,kamalesh-babulal/powerpc-utils