man page says: -c Create the passwdfile. If passwdfile already exists, it is deleted first.
And from older version, one can guess file was effectively truncated: fopen("w"). https://svn.apache.org/viewvc/httpd/httpd/trunk/support/htdigest.c?r1=85063&r2=85064 (That was 11 years ago...) So I suggest we just to add APR_TRUNCATE to apr_file_open(APR_WRITE | APR_CREATE) to keep the documented behavior. On the other hand, bailing out really makes sense to me. Issue should be discussed upstream. I'm attaching a fix for the "inconsistent behaviour" bug.
--- support/htdigest.c 2012-02-03 16:18:17.000000000 +0100 +++ /home/nirgal/htdigest.c 2012-02-03 16:16:42.000000000 +0100 @@ -212,7 +212,7 @@ if (argc == 5) { if (strcmp(argv[1], "-c")) usage(); - rv = apr_file_open(&f, argv[2], APR_WRITE | APR_CREATE, + rv = apr_file_open(&f, argv[2], APR_WRITE | APR_CREATE | APR_TRUNCATE, APR_OS_DEFAULT, cntxt); if (rv != APR_SUCCESS) { char errmsg[120];