/* * test case to demonstrate bug in smbw_fork() behaviour * * compile: * cc $(getconf LFS_CFLAGS) -o opentest opentest.c * * run: * $ smbsh -U 'user%password' -d 4 * $ ./opentest */ #include #include #include #include #include #include #include #include #define FILE "/smb/WORKGROUP/192.168.44.11/directory/nonexistentfile" int main ( int argc, char *argv[] ) { int ret; struct stat statbuf; char *file; if ( argc == 1 ) { file = FILE; } else { file = argv[1]; } ret = stat( file, &statbuf ); if ( ret < 0 ) { fprintf( stderr, "stat failed - errno = %d (%s)\n", errno, strerror(errno) ); } if (fork() != 0) { /* parent process -- will discover that child has terminated sessions */ ret = lstat( file, &statbuf ); if ( ret < 0 ) { fprintf( stderr, "lstat failed - errno = %d (%s)\n", errno, strerror(errno) ); } } exit (0); }