aboutsummaryrefslogtreecommitdiff
path: root/src/user.c
diff options
context:
space:
mode:
authorAlan Brault <alan.brault@incruentatus.net>2011-05-02 18:58:40 -0400
committerJoseph Hunkeler <jhunk@stsci.edu>2012-05-25 14:21:08 -0400
commit0b20b98e9b2e87eb2e9e10f658d2d523b0ee9fb6 (patch)
tree942d28cad437dd20bf29cb60ad58ad4949b87c96 /src/user.c
parentdb970762d90a3adda07874ac597928f5305b0a49 (diff)
downloadduser-0b20b98e9b2e87eb2e9e10f658d2d523b0ee9fb6.tar.gz
Remove strcasestr() and strchrnul() checks from configure, using libdusercompat.a instead
Fix Makefile.am bad entry Clean up compat, bring in strcasestr from OpenBSD and strchrnul from uclibc and separate the headers. Remove config.h from strchrnul.c; not needed Fix numerous shadow declaration bugs that could cause problems for Solaris libc Fix bad prototype using in unlink()
Diffstat (limited to 'src/user.c')
-rw-r--r--src/user.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/user.c b/src/user.c
index 3ff49b4..3c6ffd0 100644
--- a/src/user.c
+++ b/src/user.c
@@ -159,16 +159,16 @@ int user_del(record_t* rec)
int bytes = 0;
int bytes_total = 0;
char buf[REGEX_MAX];
- char tmpfile[255];
- snprintf(tmpfile, sizeof(tmpfile), "/tmp/duser.%s.XXXXXX", basename(rec->file));
- if((fd = mkstemp(tmpfile)) < 0 || (tfp = fdopen(fd, "r+")) == NULL)
+ char _tmpfile[255];
+ snprintf(_tmpfile, sizeof(_tmpfile), "/tmp/duser.%s.XXXXXX", basename(rec->file));
+ if((fd = mkstemp(_tmpfile)) < 0 || (tfp = fdopen(fd, "r+")) == NULL)
{
if(fd != -1)
{
close(fd);
- unlink(tmpfile);
+ unlink(_tmpfile);
}
- fprintf(stderr, "FATAL: %s: %s: %s\n", SELF, tmpfile, strerror(errno));
+ fprintf(stderr, "FATAL: %s: %s: %s\n", SELF, _tmpfile, strerror(errno));
exit(1);
}
@@ -220,7 +220,10 @@ int user_del(record_t* rec)
fclose(fp);
close(fd);
- unlink(tmpfile);
+
+ /* unistd.h requires this be a (const char *) not (struct FILE * (*)(void)) */
+ /* -- extrarius -- */
+ unlink((const char *)tmpfile);
if(bytes_total)
return bytes_total;
@@ -266,7 +269,7 @@ record_t* find_in_file(const char* filename, const char* needle)
rptr->index = 0;
rptr->match = 0;
- int index = 0;
+ int _index = 0;
FILE *fp;
char *fname = strdup(filename);
@@ -287,9 +290,9 @@ record_t* find_in_file(const char* filename, const char* needle)
{
snprintf(rptr->name, REGEX_MAX, "%s", cmp);
rptr->match = 1;
- rptr->index = index;
+ rptr->index = _index;
}
- index++;
+ _index++;
processed.lines++;
}