int val;
- if( (val = fcntl( fd, F_GETFL, 0) ) < 0 ) {
- fprintf(stderr, "fcntl F_GETFL error");
+ if( (val = fcntl( fd, F_GETFL, 0) ) < 0 )
return -1;
- }
val |= flags;
- if( fcntl( fd, F_SETFL, val ) < 0 ) {
- fprintf(stderr, "fcntl F_SETFL error");
+ if( fcntl( fd, F_SETFL, val ) < 0 )
return -1;
- }
+
return 0;
}
int val;
- if( (val = fcntl( fd, F_GETFL, 0) ) < 0 ) {
- fprintf(stderr, "fcntl F_GETFL error" );
+ if( (val = fcntl( fd, F_GETFL, 0) ) < 0 )
return -1;
- }
val &= ~flags;
- if( fcntl( fd, F_SETFL, val ) < 0 ) {
- fprintf( stderr, "fcntl F_SETFL error" );
+ if( fcntl( fd, F_SETFL, val ) < 0 )
return -1;
- }
+
return 0;
}