/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2011 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
}
if ( strcmp( argv[ 1 ], "-" ) == 0 ) {
- size_t len;
-
- fgets( buf, sizeof( buf ), stdin );
- len = strlen( buf );
- if ( len > 0 && buf[ --len ] == '\n' ) {
+ size_t len = fgets( buf, sizeof( buf ), stdin ) ? strlen( buf ) : 0;
+
+ if ( len == 0 || buf[ --len ] == '\n' ) {
buf[ len ] = '\0';
}
strin = buf;
return( 0 );
}
-