version 1.7, 2008/11/14 11:58:08 |
version 1.8, 2009/12/07 18:43:11 |
|
|
#include "sudo.h" |
#include "sudo.h" |
|
|
#ifndef lint |
#ifndef lint |
__unused static const char rcsid[] = "$Sudo: sudo_edit.c,v 1.37 2008/11/09 14:13:12 millert Exp $"; |
__unused static const char rcsid[] = "$Sudo: sudo_edit.c,v 1.39 2009/09/30 13:50:58 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
extern sigaction_t saved_sa_int, saved_sa_quit, saved_sa_tstp; |
extern sigaction_t saved_sa_int, saved_sa_quit, saved_sa_tstp; |
|
|
} |
} |
close(ofd); |
close(ofd); |
} |
} |
#ifdef HAVE_FSTAT |
|
/* |
/* |
* If we are unable to set the mtime on the temp file to the value |
* We always update the stashed mtime because the time |
* of the original file just make the stashed mtime match the temp |
* resolution of the filesystem the temporary file is on may |
* file's mtime. It is better than nothing and we only use the info |
* not match that of the filesystem where the file to be edited |
|
* resides. It is OK if touch() fails since we only use the info |
* to determine whether or not a file has been modified. |
* to determine whether or not a file has been modified. |
*/ |
*/ |
if (touch(tfd, NULL, &tf[i].omtim) == -1) { |
(void) touch(tfd, NULL, &tf[i].omtim); |
if (fstat(tfd, &sb) == 0) { |
#ifdef HAVE_FSTAT |
tf[i].omtim.tv_sec = mtim_getsec(sb); |
error = fstat(tfd, &sb); |
tf[i].omtim.tv_nsec = mtim_getnsec(sb); |
#else |
} |
error = stat(tf[i].tfile, &sb); |
/* XXX - else error? */ |
|
} |
|
#endif |
#endif |
|
if (!error) { |
|
tf[i].omtim.tv_sec = mtim_getsec(sb); |
|
tf[i].omtim.tv_nsec = mtim_getnsec(sb); |
|
} |
close(tfd); |
close(tfd); |
} |
} |
if (argc == 1) |
if (argc == 1) |
|
|
(void) sigaction(SIGINT, &saved_sa_int, NULL); |
(void) sigaction(SIGINT, &saved_sa_int, NULL); |
(void) sigaction(SIGQUIT, &saved_sa_quit, NULL); |
(void) sigaction(SIGQUIT, &saved_sa_quit, NULL); |
set_perms(PERM_FULL_USER); |
set_perms(PERM_FULL_USER); |
closefrom(def_closefrom + 1); |
closefrom(def_closefrom); |
execvp(nargv[0], nargv); |
execvp(nargv[0], nargv); |
warning("unable to execute %s", nargv[0]); |
warning("unable to execute %s", nargv[0]); |
_exit(127); |
_exit(127); |