4 TARGET
="${SYSCTL}/kernel/domainname"
5 ORIG
=$
(cat "${TARGET}")
6 TEST_STR
="Testing sysctl"
10 # Only string sysctls support seeking/appending.
13 echo -n "Writing entire sysctl in short writes ... "
15 dd if="${TEST_FILE}" of
="${TARGET}" bs
=1 2>/dev
/null
16 if ! verify
"${TARGET}"; then
23 echo -n "Writing middle of sysctl after unsynchronized seek ... "
25 dd if="${TEST_FILE}" of
="${TARGET}" bs
=1 seek
=1 2>/dev
/null
26 if verify
"${TARGET}"; then
33 echo -n "Checking sysctl maxlen is at least $MAXLEN ... "
35 perl
-e 'print "A" x ('"${MAXLEN}"'-2), "B";' | \
36 dd of
="${TARGET}" bs
="${MAXLEN}" 2>/dev
/null
37 if ! grep -q B
"${TARGET}"; then
44 echo -n "Checking sysctl keeps original string on overflow append ... "
46 perl
-e 'print "A" x ('"${MAXLEN}"'-1), "B";' | \
47 dd of
="${TARGET}" bs
=$
(( MAXLEN
- 1 )) 2>/dev
/null
48 if grep -q B
"${TARGET}"; then
55 echo -n "Checking sysctl stays NULL terminated on write ... "
57 perl
-e 'print "A" x ('"${MAXLEN}"'-1), "B";' | \
58 dd of
="${TARGET}" bs
="${MAXLEN}" 2>/dev
/null
59 if grep -q B
"${TARGET}"; then
66 echo -n "Checking sysctl stays NULL terminated on overwrite ... "
68 perl
-e 'print "A" x ('"${MAXLEN}"'-1), "BB";' | \
69 dd of
="${TARGET}" bs
=$
(( $MAXLEN + 1 )) 2>/dev
/null
70 if grep -q B
"${TARGET}"; then