- include the dictionary filename suffix in error messages

This commit is contained in:
Nalin Dahyabhai 2007-07-19 14:04:02 +00:00
parent cc74371eea
commit c814b8b364

View File

@ -0,0 +1,31 @@
Tiny problems in errors reported: when we're out of memory, report out of
memory unrelated to the filename. When we notice that the dictionary isn't
there, give the name of the file which wasn't there.
diff -up cracklib-2.8.10/python/cracklibmodule.c cracklib-2.8.10/python/cracklibmodule.c
--- cracklib-2.8.10/python/cracklibmodule.c 2007-01-26 11:55:07.000000000 -0500
+++ cracklib-2.8.10/python/cracklibmodule.c 2007-07-19 09:55:22.000000000 -0400
@@ -58,13 +58,13 @@ cracklib_FascistCheck(PyObject *self, Py
dictfile = malloc(strlen(dict) + sizeof(DICT_SUFFIX));
if (dictfile == NULL)
{
- PyErr_SetFromErrnoWithFilename(PyExc_OSError, dict);
+ PyErr_SetFromErrno(PyExc_MemoryError);
return NULL;
}
sprintf(dictfile, "%s" DICT_SUFFIX, dict);
if (lstat(dictfile, &st) == -1)
{
- PyErr_SetFromErrnoWithFilename(PyExc_OSError, dict);
+ PyErr_SetFromErrnoWithFilename(PyExc_OSError, dictfile);
free(dictfile);
return NULL;
}
@@ -74,7 +74,7 @@ cracklib_FascistCheck(PyObject *self, Py
if (lstat(DEFAULT_CRACKLIB_DICT DICT_SUFFIX, &st) == -1)
{
PyErr_SetFromErrnoWithFilename(PyExc_OSError,
- DEFAULT_CRACKLIB_DICT);
+ DEFAULT_CRACKLIB_DICT DICT_SUFFIX);
return NULL;
}
}