blob: 6de50fa7bdb155cb83a911c571d66a0928745ebf [file] [log] [blame]
Mike Frysinger3c7167b2009-04-06 12:36:10 +00001# make sure we have a way of checking these things
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +00002cd /proc/$$/fd || cd /dev/fd || exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +00003
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +00004[ -e 44 ] && exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +00005exec 44>/dev/null
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +00006[ -e 44 ] || exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +00007echo pass fd out open
8
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +00009[ -e 55 ] && exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +000010exec 55>&44
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +000011[ -e 55 ] || exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +000012echo pass fd out dup
13
14exec 44>&-
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +000015[ -e 44 ] && exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +000016echo pass fd out close
17
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +000018[ -e 66 ] && exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +000019exec 66</dev/null
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +000020[ -e 66 ] || exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +000021echo pass fd in open
22
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +000023[ -e 77 ] && exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +000024exec 77<&66
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +000025[ -e 77 ] || exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +000026echo pass fd in dup
27
28exec 66<&-
Denis Vlasenko6c9be7f2009-04-07 02:29:51 +000029[ -e 66 ] && exit 1
Mike Frysinger3c7167b2009-04-06 12:36:10 +000030echo pass fd in close